├── __init__.py
├── static
├── skin-config_files
│ ├── statistics.txt
│ ├── getConfig.js
│ ├── _tts_browser_center.js
│ └── sea.js
├── js
│ ├── plugins
│ │ ├── dataTables
│ │ │ ├── swf
│ │ │ │ └── copy_csv_xls_pdf.swf
│ │ │ └── dataTables.bootstrap.js
│ │ ├── gritter
│ │ │ ├── images
│ │ │ │ ├── gritter.png
│ │ │ │ ├── ie-spacer.gif
│ │ │ │ └── gritter-light.png
│ │ │ ├── jquery.gritter.css
│ │ │ └── jquery.gritter.min.js
│ │ ├── swf
│ │ │ └── copy_csv_xls_pdf.swf
│ │ ├── summernote
│ │ │ └── }),e.html(j.c+
│ │ ├── jvectormap
│ │ │ └── jvm.DataSeries.html
│ │ ├── video
│ │ │ └── responsible-video.js
│ │ ├── idle-timer
│ │ │ └── idle-timer.min.js
│ │ ├── flot
│ │ │ ├── jquery.flot.symbol.js
│ │ │ ├── jquery.flot.resize.js
│ │ │ ├── jquery.flot.tooltip.min.js
│ │ │ └── jquery.flot.spline.js
│ │ ├── preetyTextDiff
│ │ │ └── jquery.pretty-text-diff.min.js
│ │ ├── metisMenu
│ │ │ └── jquery.metisMenu.js
│ │ ├── peity
│ │ │ └── jquery.peity.min.js
│ │ ├── toastr
│ │ │ └── toastr.min.js
│ │ ├── slimscroll
│ │ │ └── jquery.slimscroll.min.js
│ │ ├── tinycon
│ │ │ └── tinycon.min.js
│ │ ├── iCheck
│ │ │ └── icheck.min.js
│ │ ├── jqGrid
│ │ │ └── i18n
│ │ │ │ └── grid.locale-en.js
│ │ ├── pace
│ │ │ └── pace.min.js
│ │ ├── ionRangeSlider
│ │ │ └── ion.rangeSlider.min.js
│ │ └── nouslider
│ │ │ └── jquery.nouislider.min.js
│ ├── skin-config.html
│ ├── demo
│ │ ├── peity-demo.js
│ │ ├── sparkline-demo.js
│ │ ├── morris-demo.js
│ │ ├── rickshaw-demo.js
│ │ └── chartjs-demo.js
│ ├── selectPage.js
│ └── inspinia.js
├── initInfo.js
├── pages
│ ├── head.html
│ ├── delete.html
│ ├── update.html
│ ├── rulesWeb.html
│ └── rulesWeb1.html
├── rules.css
├── delete.js
├── update.js
├── show.js
└── selectCss.css
├── PrometheusDao.pyc
├── PrometheusConfig.pyc
├── PrometheusService.pyc
├── PrometheusConfig.py
├── PrometheusDao.py
├── PrometheusService.py
└── PrometheusController.py
/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/static/skin-config_files/statistics.txt:
--------------------------------------------------------------------------------
1 | true
--------------------------------------------------------------------------------
/static/js/plugins/dataTables/swf/copy_csv_xls_pdf.swf:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/PrometheusDao.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/1182640071/AddRulesWeb/HEAD/PrometheusDao.pyc
--------------------------------------------------------------------------------
/PrometheusConfig.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/1182640071/AddRulesWeb/HEAD/PrometheusConfig.pyc
--------------------------------------------------------------------------------
/PrometheusService.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/1182640071/AddRulesWeb/HEAD/PrometheusService.pyc
--------------------------------------------------------------------------------
/static/js/plugins/gritter/images/gritter.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/1182640071/AddRulesWeb/HEAD/static/js/plugins/gritter/images/gritter.png
--------------------------------------------------------------------------------
/static/js/plugins/gritter/images/ie-spacer.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/1182640071/AddRulesWeb/HEAD/static/js/plugins/gritter/images/ie-spacer.gif
--------------------------------------------------------------------------------
/static/skin-config_files/getConfig.js:
--------------------------------------------------------------------------------
1 | TTSUI19107506870177006427_1449111322218({"state":false,"thirdPartUnion":100,"thirdPartNews":0,"thirdPartAd":50})
--------------------------------------------------------------------------------
/static/js/plugins/gritter/images/gritter-light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/1182640071/AddRulesWeb/HEAD/static/js/plugins/gritter/images/gritter-light.png
--------------------------------------------------------------------------------
/PrometheusConfig.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | filepath = '/tmp/rules.d/'
4 |
5 | services = ['ct', 'si']
6 |
7 | alarms = ['warning', 'average', 'high', 'disaster']
8 |
9 | target = '127.0.0.1'
10 |
--------------------------------------------------------------------------------
/static/js/skin-config.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | 404 Not Found
4 |
5 | Not Found
6 | The requested URL /bootstrap/WB0R5L90S/js/skin-config.html was not found on this server.
7 |
8 | Apache/2.2.15 (CentOS) Server at sysving.com Port 80
9 |
10 |
--------------------------------------------------------------------------------
/static/js/plugins/swf/copy_csv_xls_pdf.swf:
--------------------------------------------------------------------------------
1 |
2 |
3 | 404 Not Found
4 |
5 | Not Found
6 | The requested URL /bootstrap/WB0R5L90S/js/plugins/swf/copy_csv_xls_pdf.swf was not found on this server.
7 |
8 | Apache/2.2.15 (CentOS) Server at sysving.com Port 80
9 |
10 |
--------------------------------------------------------------------------------
/static/js/plugins/summernote/}),e.html(j.c+:
--------------------------------------------------------------------------------
1 |
2 |
3 | 404 Not Found
4 |
5 | Not Found
6 | The requested URL /bootstrap/WB0R5L90S/js/plugins/summernote/}),e.html(j.c+ was not found on this server.
7 |
8 | Apache/2.2.15 (CentOS) Server at sysving.com Port 80
9 |
10 |
--------------------------------------------------------------------------------
/static/js/plugins/jvectormap/jvm.DataSeries.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | 404 Not Found
4 |
5 | Not Found
6 | The requested URL /bootstrap/WB0R5L90S/js/plugins/jvectormap/jvm.DataSeries.html was not found on this server.
7 |
8 | Apache/2.2.15 (CentOS) Server at sysving.com Port 80
9 |
10 |
--------------------------------------------------------------------------------
/static/js/plugins/video/responsible-video.js:
--------------------------------------------------------------------------------
1 | $(function() {
2 | var $allVideos = $("iframe[src^='http://player.vimeo.com'], iframe[src^='http://www.youtube.com'], object, embed"),
3 | $fluidEl = $("figure");
4 |
5 | $allVideos.each(function() {
6 | $(this)
7 | // jQuery .data does not work on object/embed elements
8 | .attr('data-aspectRatio', this.height / this.width)
9 | .removeAttr('height')
10 | .removeAttr('width');
11 | });
12 | $(window).resize(function() {
13 | var newWidth = $fluidEl.width();
14 | $allVideos.each(function() {
15 | var $el = $(this);
16 | $el
17 | .width(newWidth)
18 | .height(newWidth * $el.attr('data-aspectRatio'));
19 | });
20 | }).resize();
21 | });
--------------------------------------------------------------------------------
/static/js/demo/peity-demo.js:
--------------------------------------------------------------------------------
1 | $(function() {
2 | $("span.pie").peity("pie", {
3 | fill: ['#1ab394', '#d7d7d7', '#ffffff']
4 | })
5 |
6 | $(".line").peity("line",{
7 | fill: '#1ab394',
8 | stroke:'#169c81',
9 | })
10 |
11 | $(".bar").peity("bar", {
12 | fill: ["#1ab394", "#d7d7d7"]
13 | })
14 |
15 | $(".bar_dashboard").peity("bar", {
16 | fill: ["#1ab394", "#d7d7d7"],
17 | width:100
18 | })
19 |
20 | var updatingChart = $(".updating-chart").peity("line", { fill: '#1ab394',stroke:'#169c81', width: 64 })
21 |
22 | setInterval(function() {
23 | var random = Math.round(Math.random() * 10)
24 | var values = updatingChart.text().split(",")
25 | values.shift()
26 | values.push(random)
27 |
28 | updatingChart
29 | .text(values.join(","))
30 | .change()
31 | }, 1000);
32 |
33 | });
34 |
--------------------------------------------------------------------------------
/static/initInfo.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by wml on 2019/1/2.
3 | */
4 |
5 |
6 | //加载数据,包括监控组
7 | jQuery.ajax({
8 | type: "POST",
9 | url: "/prometheus/GetInfo",
10 | dataType: 'json',
11 | async: false,
12 | error: function () {
13 | alert("操作失败,请稍等片刻重新尝试,如仍有问题请联系管理员......");
14 | return false;
15 | },
16 | success : function(result){
17 | for(item in result.servers){
18 | //alert(result.servers[item]);
19 | $("#service_select").append('');
20 | }
21 | var html = '';
22 | for (item in result.alerm){
23 | //alert(result.alerm[item]);
24 | //html = html + '';
25 |
26 | $("#rules_select").append('');
27 | }
28 | //$("#list_select_rules").html(html);
29 | }
30 | });
--------------------------------------------------------------------------------
/static/js/demo/sparkline-demo.js:
--------------------------------------------------------------------------------
1 | $(function () {
2 | $("#sparkline1").sparkline([34, 43, 43, 35, 44, 32, 44, 52, 25], {
3 | type: 'line',
4 | lineColor: '#17997f',
5 | fillColor: '#1ab394',
6 | });
7 | $("#sparkline2").sparkline([5, 6, 7, 2, 0, -4, -2, 4], {
8 | type: 'bar',
9 | barColor: '#1ab394',
10 | negBarColor: '#c6c6c6'});
11 |
12 | $("#sparkline3").sparkline([1, 1, 2], {
13 | type: 'pie',
14 | sliceColors: ['#1ab394', '#b3b3b3', '#e4f0fb']});
15 |
16 | $("#sparkline4").sparkline([34, 43, 43, 35, 44, 32, 15, 22, 46, 33, 86, 54, 73, 53, 12, 53, 23, 65, 23, 63, 53, 42, 34, 56, 76, 15, 54, 23, 44], {
17 | type: 'line',
18 | lineColor: '#17997f',
19 | fillColor: '#ffffff',
20 | });
21 |
22 | $("#sparkline5").sparkline([1, 1, 0, 1, -1, -1, 1, -1, 0, 0, 1, 1], {
23 | type: 'tristate',
24 | posBarColor: '#1ab394',
25 | negBarColor: '#bfbfbf'});
26 |
27 |
28 | $("#sparkline6").sparkline([4, 6, 7, 7, 4, 3, 2, 1, 4, 4, 5, 6, 3, 4, 5, 8, 7, 6, 9, 3, 2, 4, 1, 5, 6, 4, 3, 7, ], {
29 | type: 'discrete',
30 | lineColor: '#1ab394'});
31 |
32 | $("#sparkline7").sparkline([52, 12, 44], {
33 | type: 'pie',
34 | height: '150px',
35 | sliceColors: ['#1ab394', '#b3b3b3', '#e4f0fb']});
36 |
37 | $("#sparkline8").sparkline([5, 6, 7, 2, 0, 4, 2, 4, 5, 7, 2, 4, 12, 14, 4, 2, 14, 12, 7], {
38 | type: 'bar',
39 | barWidth: 8,
40 | height: '150px',
41 | barColor: '#1ab394',
42 | negBarColor: '#c6c6c6'});
43 |
44 | $("#sparkline9").sparkline([34, 43, 43, 35, 44, 32, 15, 22, 46, 33, 86, 54, 73, 53, 12, 53, 23, 65, 23, 63, 53, 42, 34, 56, 76, 15, 54, 23, 44], {
45 | type: 'line',
46 | lineWidth: 1,
47 | height: '150px',
48 | lineColor: '#17997f',
49 | fillColor: '#ffffff',
50 | });
51 | });
52 |
--------------------------------------------------------------------------------
/static/pages/head.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | add rules
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
Prometheus
15 |
16 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/PrometheusDao.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from PrometheusConfig import filepath
3 | import os
4 |
5 |
6 | def write_file(filename, content):
7 |
8 | if filepath.endswith('/'):
9 | rule_file = filepath + filename + '.yml'
10 | else:
11 | rule_file = filepath + '/' + filename + '.yml'
12 | try:
13 | with open(rule_file, 'w') as f:
14 | f.write(content)
15 | return 0
16 | except Exception, e:
17 | print e
18 | return 1
19 |
20 |
21 | def update_write_file(filename, content, _name):
22 |
23 | if filepath.endswith('/'):
24 | rule_file = filepath + filename + '.yml'
25 | _file = filepath + _name + '.yml'
26 | else:
27 | rule_file = filepath + '/' + filename + '.yml'
28 | _file = filepath + '/' + _name + '.yml'
29 |
30 | os.system("mv " + _file + ' ' + rule_file)
31 |
32 | try:
33 | with open(rule_file, 'w') as f:
34 | f.write(content)
35 | return 0
36 | except Exception, e:
37 | print e
38 | return 1
39 |
40 |
41 | def delete_file(_name):
42 |
43 | if filepath.endswith('/'):
44 | _file = filepath + _name + '.yml'
45 | else:
46 | _file = filepath + '/' + _name + '.yml'
47 |
48 | try:
49 | os.system("rm -rf " + _file)
50 | return 0
51 | except Exception, e:
52 | print e
53 | return 1
54 |
55 |
56 | def get_rules():
57 | rs = []
58 | try:
59 | for root, dirs, files in os.walk(filepath):
60 | rs.append(files)
61 | except Exception, e:
62 | print e
63 | return rs
64 |
65 |
66 | def get_detail(filename):
67 | try:
68 | if filepath.endswith('/'):
69 | rule_file = filepath + filename + '.yml'
70 | else:
71 | rule_file = filepath + '/' + filename + '.yml'
72 |
73 | content = os.popen('head -1 ' + rule_file).read()
74 | values = eval(content[1:len(content)])
75 | return values
76 | except Exception, e:
77 | print e
78 | return {'name': '', 'alert': '', 'expr': '', '_for': '', 'level': '', 'summary': '', 'description': ''}
79 |
--------------------------------------------------------------------------------
/static/rules.css:
--------------------------------------------------------------------------------
1 | .headline {
2 | position:absolute;
3 | background-color: black;
4 | border-color: #080808;
5 | width: 100%;
6 | height: 65px;
7 | top: 0;
8 | left: 0;
9 | }
10 |
11 | .head_title {
12 | position: absolute;
13 | width: 80px;
14 | left: 10px;
15 | top: 4px;
16 | height: 65px;
17 | }
18 |
19 | .title_refresh {
20 | position: absolute;
21 | width: 80px;
22 | right: 10px;
23 | top: 4px;
24 | height: 65px;
25 | }
26 |
27 | .head_title h3 {
28 | color: gray;
29 | position: absolute;
30 | left: 1%;
31 | top: 0;
32 | }
33 |
34 |
35 | /*.head_ul ul {*/
36 | /*list-style:none; !* 去掉ul前面的符号 *!*/
37 | /*margin: 0; !* 与外界元素的距离为0 *!*/
38 | /*padding: 0; !* 与内部元素的距离为0 *!*/
39 | /*!*width: auto; !* 宽度根据元素内容调整 *!*!*/
40 | /*position: absolute;*/
41 | /*left: 151px;*/
42 | /*width: 90%;*/
43 | /*height: 65px;*/
44 | /*}*/
45 |
46 | .title_head {
47 | list-style:none;
48 | margin: 0;
49 | padding: 0;
50 | position: absolute;
51 | left: 128px;
52 | width: 90%;
53 | height: 65px;
54 | top: 0;
55 | }
56 |
57 | .head_ul ul li{
58 | float:left;
59 | margin: 0;
60 | padding: 6px;
61 | /*color: white;*/
62 | }
63 |
64 | .head_ul ul li h4{
65 | font-weight:normal;
66 | color: gray;
67 | }
68 |
69 | label {
70 | padding-top: 6px;
71 | padding-right: 12px;
72 | padding-bottom: 6px;
73 | padding-left: 12px;
74 | float: left;
75 | }
76 |
77 | .labelMonitor {
78 | background-color: #286090;
79 | border-color: #2e6da4;
80 | color: #fff;
81 | }
82 |
83 | .labelChar {
84 | background-color: #337ab7;
85 | border-color: #2e6da4;
86 | color: #fff;
87 | }
88 |
89 | .rules_add {
90 | position: absolute;
91 | top:65px;
92 | left: 15px;
93 | width: 60%;
94 | /*background-color: greenyellow;*/
95 | }
96 |
97 | .rules_add div {
98 | /*margin: 6px;*/
99 | }
--------------------------------------------------------------------------------
/static/delete.js:
--------------------------------------------------------------------------------
1 | $("#list_select_rules").change(function(){
2 | var content=$("#list_select_rules").val();
3 | jQuery.ajax({
4 | type: "POST",
5 | url: "/prometheus/getRulesDetail",
6 | dataType: 'json',
7 | data : {
8 | "name": content
9 | },
10 | async: false,
11 | error: function () {
12 | alert("操作失败,请稍等片刻重新尝试,如仍有问题请联系管理员......");
13 | return false;
14 | },
15 | success : function(result){
16 | //{'name': '', 'alert': '', 'expr': '', '_for': '', 'level': '', 'summary': '', 'description': ''}
17 |
18 | $("#name_rules").html("- name: " + result.alert + '_rules');
19 | $("#alert_rules").html(" - alert: " + result.alert);
20 | $("#rules_name").val(result.alert);
21 |
22 |
23 | $("#expr_rules").html(" expr: " + result.expr);
24 | $("#rules_expr").val(result.expr);
25 |
26 | $("#time_rules").html(" for: " + result._for);
27 | $("#rules_time").val(result._for);
28 |
29 |
30 | $("#desc_rules").html(" description: " + result.description);
31 | $("#rules_desc").val(result.description);
32 |
33 | $("#select_services").html(" service: " + result.service);
34 | var se = $('#service_select').val(result.service);
35 | se.attr('selected',true);
36 |
37 | $("#select_rules").html(" level: " + result.level);
38 | var add = $('#rules_select').val(result.level);
39 | add.attr('selected',true);
40 | }
41 | })
42 | });
43 |
44 | function del(){
45 |
46 | var label = $("#list_select_rules").val();
47 | jQuery.ajax({
48 | type: "POST",
49 | url: "/prometheus/delete",
50 | dataType: 'json',
51 | data : {
52 | "_name": label
53 | },
54 | async: false,
55 | error: function () {
56 | alert("操作失败,请稍等片刻重新尝试,如仍有问题请联系管理员......");
57 | return false;
58 | },
59 | success : function(result){
60 | alert(result);
61 | window.location.reload();
62 | }
63 | })
64 | }
--------------------------------------------------------------------------------
/PrometheusService.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from PrometheusDao import write_file, get_rules, get_detail, update_write_file, delete_file
3 |
4 |
5 | redis_fixed_text = """#{'name': '{{ name }}', 'service': '{{ service }}', 'alert': '{{ alert }}', 'expr': '{{ expr }}', '_for': '{{ for }}', 'level': '{{ level }}', 'summary': '{{ summary }}', 'description': '{{ description }}'}
6 | groups:
7 | - name: {{ name }}
8 | rules:
9 | - alert: {{ alert }}
10 | expr: {{ expr }}
11 | for: {{ for }}
12 | labels:
13 | level: "{{ level }}"
14 | service: "{{ service }}"
15 | annotations:
16 | summary: "{{ summary }}"
17 | description: "{{ description }}"
18 | """
19 |
20 |
21 | def create_rules_model(name, expr, level, _for, desc, model, service):
22 | try:
23 | rule = redis_fixed_text.replace('{{ name }}', name + '_rule')
24 | rule = rule.replace('{{ alert }}', name)
25 | rule = rule.replace('{{ expr }}', expr)
26 | rule = rule.replace('{{ for }}', _for)
27 | rule = rule.replace('{{ level }}', level)
28 | rule = rule.replace('{{ summary }}', model)
29 | rule = rule.replace('{{ description }}', desc)
30 | rule = rule.replace('{{ service }}', service)
31 | rs = write_file(name, rule)
32 | return rs
33 | except Exception, e:
34 | print e
35 | return 1
36 |
37 |
38 | def update_rules_model(name, expr, level, _for, desc, model, _name, service):
39 | try:
40 | rule = redis_fixed_text.replace('{{ name }}', name + '_rule')
41 | rule = rule.replace('{{ alert }}', name)
42 | rule = rule.replace('{{ expr }}', expr)
43 | rule = rule.replace('{{ for }}', _for)
44 | rule = rule.replace('{{ level }}', level)
45 | rule = rule.replace('{{ summary }}', model)
46 | rule = rule.replace('{{ description }}', desc)
47 | rule = rule.replace('{{ service }}', service)
48 | rs = update_write_file(name, rule, _name)
49 | return rs
50 | except Exception, e:
51 | print e
52 | return 1
53 |
54 |
55 | def delete_rules_model(_name):
56 | try:
57 | rs = delete_file(_name)
58 | return rs
59 | except Exception, e:
60 | print e
61 | return 1
62 |
63 |
64 | def get_rule():
65 | rs = get_rules()
66 | return rs
67 |
68 |
69 | def get_rule_detail(name):
70 | return get_detail(name)
71 |
--------------------------------------------------------------------------------
/static/js/plugins/idle-timer/idle-timer.min.js:
--------------------------------------------------------------------------------
1 | /*! Idle Timer v1.0.1 2014-03-21 | https://github.com/thorst/jquery-idletimer | (c) 2014 Paul Irish | Licensed MIT */
2 | !function(a){a.idleTimer=function(b,c){var d;"object"==typeof b?(d=b,b=null):"number"==typeof b&&(d={timeout:b},b=null),c=c||document,d=a.extend({idle:!1,timeout:3e4,events:"mousemove keydown wheel DOMMouseScroll mousewheel mousedown touchstart touchmove MSPointerDown MSPointerMove"},d);var e=a(c),f=e.data("idleTimerObj")||{},g=function(b){var d=a.data(c,"idleTimerObj")||{};d.idle=!d.idle,d.olddate=+new Date;var e=a.Event((d.idle?"idle":"active")+".idleTimer");a(c).trigger(e,[c,a.extend({},d),b])},h=function(b){var d=a.data(c,"idleTimerObj")||{};if(null==d.remaining){if("mousemove"===b.type){if(b.pageX===d.pageX&&b.pageY===d.pageY)return;if("undefined"==typeof b.pageX&&"undefined"==typeof b.pageY)return;var e=+new Date-d.olddate;if(200>e)return}clearTimeout(d.tId),d.idle&&g(b),d.lastActive=+new Date,d.pageX=b.pageX,d.pageY=b.pageY,d.tId=setTimeout(g,d.timeout)}},i=function(){var b=a.data(c,"idleTimerObj")||{};b.idle=b.idleBackup,b.olddate=+new Date,b.lastActive=b.olddate,b.remaining=null,clearTimeout(b.tId),b.idle||(b.tId=setTimeout(g,b.timeout))},j=function(){var b=a.data(c,"idleTimerObj")||{};null==b.remaining&&(b.remaining=b.timeout-(+new Date-b.olddate),clearTimeout(b.tId))},k=function(){var b=a.data(c,"idleTimerObj")||{};null!=b.remaining&&(b.idle||(b.tId=setTimeout(g,b.remaining)),b.remaining=null)},l=function(){var b=a.data(c,"idleTimerObj")||{};clearTimeout(b.tId),e.removeData("idleTimerObj"),e.off("._idleTimer")},m=function(){var b=a.data(c,"idleTimerObj")||{};if(b.idle)return 0;if(null!=b.remaining)return b.remaining;var d=b.timeout-(+new Date-b.lastActive);return 0>d&&(d=0),d};if(null===b&&"undefined"!=typeof f.idle)return i(),e;if(null===b);else{if(null!==b&&"undefined"==typeof f.idle)return!1;if("destroy"===b)return l(),e;if("pause"===b)return j(),e;if("resume"===b)return k(),e;if("reset"===b)return i(),e;if("getRemainingTime"===b)return m();if("getElapsedTime"===b)return+new Date-f.olddate;if("getLastActiveTime"===b)return f.lastActive;if("isIdle"===b)return f.idle}return e.on(a.trim((d.events+" ").split(" ").join("._idleTimer ")),function(a){h(a)}),f=a.extend({},{olddate:+new Date,lastActive:+new Date,idle:d.idle,idleBackup:d.idle,timeout:d.timeout,remaining:null,tId:null,pageX:null,pageY:null}),f.idle||(f.tId=setTimeout(g,f.timeout)),a.data(c,"idleTimerObj",f),e},a.fn.idleTimer=function(b){return this[0]?a.idleTimer(b,this[0]):this}}(jQuery);
--------------------------------------------------------------------------------
/static/js/plugins/flot/jquery.flot.symbol.js:
--------------------------------------------------------------------------------
1 | /* Flot plugin that adds some extra symbols for plotting points.
2 |
3 | Copyright (c) 2007-2014 IOLA and Ole Laursen.
4 | Licensed under the MIT license.
5 |
6 | The symbols are accessed as strings through the standard symbol options:
7 |
8 | series: {
9 | points: {
10 | symbol: "square" // or "diamond", "triangle", "cross"
11 | }
12 | }
13 |
14 | */
15 |
16 | (function ($) {
17 | function processRawData(plot, series, datapoints) {
18 | // we normalize the area of each symbol so it is approximately the
19 | // same as a circle of the given radius
20 |
21 | var handlers = {
22 | square: function (ctx, x, y, radius, shadow) {
23 | // pi * r^2 = (2s)^2 => s = r * sqrt(pi)/2
24 | var size = radius * Math.sqrt(Math.PI) / 2;
25 | ctx.rect(x - size, y - size, size + size, size + size);
26 | },
27 | diamond: function (ctx, x, y, radius, shadow) {
28 | // pi * r^2 = 2s^2 => s = r * sqrt(pi/2)
29 | var size = radius * Math.sqrt(Math.PI / 2);
30 | ctx.moveTo(x - size, y);
31 | ctx.lineTo(x, y - size);
32 | ctx.lineTo(x + size, y);
33 | ctx.lineTo(x, y + size);
34 | ctx.lineTo(x - size, y);
35 | },
36 | triangle: function (ctx, x, y, radius, shadow) {
37 | // pi * r^2 = 1/2 * s^2 * sin (pi / 3) => s = r * sqrt(2 * pi / sin(pi / 3))
38 | var size = radius * Math.sqrt(2 * Math.PI / Math.sin(Math.PI / 3));
39 | var height = size * Math.sin(Math.PI / 3);
40 | ctx.moveTo(x - size/2, y + height/2);
41 | ctx.lineTo(x + size/2, y + height/2);
42 | if (!shadow) {
43 | ctx.lineTo(x, y - height/2);
44 | ctx.lineTo(x - size/2, y + height/2);
45 | }
46 | },
47 | cross: function (ctx, x, y, radius, shadow) {
48 | // pi * r^2 = (2s)^2 => s = r * sqrt(pi)/2
49 | var size = radius * Math.sqrt(Math.PI) / 2;
50 | ctx.moveTo(x - size, y - size);
51 | ctx.lineTo(x + size, y + size);
52 | ctx.moveTo(x - size, y + size);
53 | ctx.lineTo(x + size, y - size);
54 | }
55 | };
56 |
57 | var s = series.points.symbol;
58 | if (handlers[s])
59 | series.points.symbol = handlers[s];
60 | }
61 |
62 | function init(plot) {
63 | plot.hooks.processDatapoints.push(processRawData);
64 | }
65 |
66 | $.plot.plugins.push({
67 | init: init,
68 | name: 'symbols',
69 | version: '1.0'
70 | });
71 | })(jQuery);
72 |
--------------------------------------------------------------------------------
/static/js/plugins/preetyTextDiff/jquery.pretty-text-diff.min.js:
--------------------------------------------------------------------------------
1 | // Generated by CoffeeScript 1.7.1
2 |
3 | /*
4 | @preserve jQuery.PrettyTextDiff 1.0.4
5 | See https://github.com/arnab/jQuery.PrettyTextDiff/
6 | */
7 |
8 | (function() {
9 | var $;
10 |
11 | $ = jQuery;
12 |
13 | $.fn.extend({
14 | prettyTextDiff: function(options) {
15 | var dmp, settings;
16 | settings = {
17 | originalContainer: ".original",
18 | changedContainer: ".changed",
19 | diffContainer: ".diff",
20 | cleanup: true,
21 | debug: false
22 | };
23 | settings = $.extend(settings, options);
24 | $.fn.prettyTextDiff.debug("Options: ", settings, settings);
25 | dmp = new diff_match_patch();
26 | return this.each(function() {
27 | var changed, diff_as_html, diffs, original;
28 | if (settings.originalContent && settings.changedContent) {
29 | original = $('').html(settings.originalContent).text();
30 | changed = $('').html(settings.changedContent).text();
31 | } else {
32 | original = $(settings.originalContainer, this).text();
33 | changed = $(settings.changedContainer, this).text();
34 | }
35 | $.fn.prettyTextDiff.debug("Original text found: ", original, settings);
36 | $.fn.prettyTextDiff.debug("Changed text found: ", changed, settings);
37 | diffs = dmp.diff_main(original, changed);
38 | if (settings.cleanup) {
39 | dmp.diff_cleanupSemantic(diffs);
40 | }
41 | $.fn.prettyTextDiff.debug("Diffs: ", diffs, settings);
42 | diff_as_html = $.map(diffs, function(diff) {
43 | return $.fn.prettyTextDiff.createHTML(diff);
44 | });
45 | $(settings.diffContainer, this).html(diff_as_html.join(''));
46 | return this;
47 | });
48 | }
49 | });
50 |
51 | $.fn.prettyTextDiff.debug = function(message, object, settings) {
52 | if (settings.debug) {
53 | return console.log(message, object);
54 | }
55 | };
56 |
57 | $.fn.prettyTextDiff.createHTML = function(diff) {
58 | var data, html, operation, pattern_amp, pattern_gt, pattern_lt, pattern_para, text;
59 | html = [];
60 | pattern_amp = /&/g;
61 | pattern_lt = //g;
63 | pattern_para = /\n/g;
64 | operation = diff[0], data = diff[1];
65 | text = data.replace(pattern_amp, '&').replace(pattern_lt, '<').replace(pattern_gt, '>').replace(pattern_para, '
');
66 | switch (operation) {
67 | case DIFF_INSERT:
68 | return '' + text + '';
69 | case DIFF_DELETE:
70 | return '' + text + '';
71 | case DIFF_EQUAL:
72 | return '' + text + '';
73 | }
74 | };
75 |
76 | }).call(this);
77 |
--------------------------------------------------------------------------------
/static/js/plugins/metisMenu/jquery.metisMenu.js:
--------------------------------------------------------------------------------
1 | /*
2 | * metismenu - v2.0.2
3 | * A jQuery menu plugin
4 | * https://github.com/onokumus/metisMenu
5 | *
6 | * Made by Osman Nuri Okumus
7 | * Under MIT License
8 | */
9 |
10 | !function(a){"use strict";function b(){var a=document.createElement("mm"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}function c(b){return this.each(function(){var c=a(this),d=c.data("mm"),f=a.extend({},e.DEFAULTS,c.data(),"object"==typeof b&&b);d||c.data("mm",d=new e(this,f)),"string"==typeof b&&d[b]()})}a.fn.emulateTransitionEnd=function(b){var c=!1,e=this;a(this).one("mmTransitionEnd",function(){c=!0});var f=function(){c||a(e).trigger(d.end)};return setTimeout(f,b),this};var d=b();d&&(a.event.special.mmTransitionEnd={bindType:d.end,delegateType:d.end,handle:function(b){return a(b.target).is(this)?b.handleObj.handler.apply(this,arguments):void 0}});var e=function(b,c){this.$element=a(b),this.options=a.extend({},e.DEFAULTS,c),this.transitioning=null,this.init()};e.TRANSITION_DURATION=350,e.DEFAULTS={toggle:!0,doubleTapToGo:!1,activeClass:"active"},e.prototype.init=function(){var b=this,c=this.options.activeClass;this.$element.find("li."+c).has("ul").children("ul").addClass("collapse in"),this.$element.find("li").not("."+c).has("ul").children("ul").addClass("collapse"),this.options.doubleTapToGo&&this.$element.find("li."+c).has("ul").children("a").addClass("doubleTapToGo"),this.$element.find("li").has("ul").children("a").on("click.metisMenu",function(d){var e=a(this),f=e.parent("li"),g=f.children("ul");return d.preventDefault(),f.hasClass(c)?b.hide(g):b.show(g),b.options.doubleTapToGo&&b.doubleTapToGo(e)&&"#"!==e.attr("href")&&""!==e.attr("href")?(d.stopPropagation(),void(document.location=e.attr("href"))):void 0})},e.prototype.doubleTapToGo=function(a){var b=this.$element;return a.hasClass("doubleTapToGo")?(a.removeClass("doubleTapToGo"),!0):a.parent().children("ul").length?(b.find(".doubleTapToGo").removeClass("doubleTapToGo"),a.addClass("doubleTapToGo"),!1):void 0},e.prototype.show=function(b){var c=this.options.activeClass,f=a(b),g=f.parent("li");if(!this.transitioning&&!f.hasClass("in")){g.addClass(c),this.options.toggle&&this.hide(g.siblings().children("ul.in")),f.removeClass("collapse").addClass("collapsing").height(0),this.transitioning=1;var h=function(){f.removeClass("collapsing").addClass("collapse in").height(""),this.transitioning=0};return d?void f.one("mmTransitionEnd",a.proxy(h,this)).emulateTransitionEnd(e.TRANSITION_DURATION).height(f[0].scrollHeight):h.call(this)}},e.prototype.hide=function(b){var c=this.options.activeClass,f=a(b);if(!this.transitioning&&f.hasClass("in")){f.parent("li").removeClass(c),f.height(f.height())[0].offsetHeight,f.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var g=function(){this.transitioning=0,f.removeClass("collapsing").addClass("collapse")};return d?void f.height(0).one("mmTransitionEnd",a.proxy(g,this)).emulateTransitionEnd(e.TRANSITION_DURATION):g.call(this)}};var f=a.fn.metisMenu;a.fn.metisMenu=c,a.fn.metisMenu.Constructor=e,a.fn.metisMenu.noConflict=function(){return a.fn.metisMenu=f,this}}(jQuery);
--------------------------------------------------------------------------------
/static/update.js:
--------------------------------------------------------------------------------
1 | $("#list_select_rules").change(function(){
2 | var content=$("#list_select_rules").val();
3 | jQuery.ajax({
4 | type: "POST",
5 | url: "/prometheus/getRulesDetail",
6 | dataType: 'json',
7 | data : {
8 | "name": content
9 | },
10 | async: false,
11 | error: function () {
12 | alert("操作失败,请稍等片刻重新尝试,如仍有问题请联系管理员......");
13 | return false;
14 | },
15 | success : function(result){
16 | //{'name': '', 'alert': '', 'expr': '', '_for': '', 'level': '', 'summary': '', 'description': ''}
17 |
18 | $("#name_rules").html("- name: " + result.alert + '_rules');
19 | $("#alert_rules").html(" - alert: " + result.alert);
20 | $("#rules_name").val(result.alert);
21 |
22 |
23 | $("#expr_rules").html(" expr: " + result.expr);
24 | $("#rules_expr").val(result.expr);
25 |
26 | $("#time_rules").html(" for: " + result._for);
27 | $("#rules_time").val(result._for);
28 |
29 | $("#desc_rules").html(" description: " + result.description);
30 | $("#rules_desc").val(result.description);
31 |
32 | $("#select_services").html(" service: " + result.service);
33 | var se = $('#service_select').val(result.service);
34 | se.attr('selected',true);
35 |
36 | $("#select_rules").html(" level: " + result.level);
37 | var add = $('#rules_select').val(result.level);
38 | add.attr('selected',true);
39 | }
40 | })
41 | });
42 |
43 | function update(){
44 | var label = $("#list_select_rules").val();
45 | var name = $("#rules_name").val().trim();
46 | var expr = $("#rules_expr").val().trim();
47 | var _for = $("#rules_time").val().trim();
48 | var level = $("#rules_select").val().trim();
49 | var desc = $("#rules_desc").val().trim();
50 | var model = $("#rules_model").val().trim();
51 | var server = $("#service_select").val().trim();
52 |
53 | if(name == "" || expr == "" || _for == "" || level == "" || desc == "" || server == ""){
54 | alert("参数不能为空,请补全参数");
55 | return;
56 | }
57 | //alert(name + ' ' + expr + ' ' + _for + ' ' + level + ' ' + desc + ' ' + model);
58 |
59 | jQuery.ajax({
60 | type: "POST",
61 | url: "/prometheus/update",
62 | dataType: 'json',
63 | data : {
64 | "_name": label,
65 | "name": name,
66 | "expr": expr,
67 | "_for": _for,
68 | "level": level,
69 | "desc": desc,
70 | "model": model,
71 | "service": server
72 | },
73 | async: false,
74 | error: function () {
75 | alert("操作失败,请稍等片刻重新尝试,如仍有问题请联系管理员......");
76 | return false;
77 | },
78 | success : function(result){
79 | alert(result);
80 | window.location.reload();
81 | }
82 | })
83 | }
--------------------------------------------------------------------------------
/static/js/plugins/gritter/jquery.gritter.css:
--------------------------------------------------------------------------------
1 | /* the norm */
2 | #gritter-notice-wrapper {
3 | position:fixed;
4 | top:40px;
5 | right:20px;
6 | width:301px;
7 | z-index:9999;
8 |
9 | -webkit-animation-duration: 1s;
10 | animation-duration: 1s;
11 | -webkit-animation-fill-mode: both;
12 | animation-fill-mode: both;
13 |
14 | -webkit-animation-name: bounceIn;
15 | animation-name: bounceIn;
16 | }
17 | @keyframes bounceIn {
18 | 0% {
19 | opacity: 0;
20 | -webkit-transform: scale(.3);
21 | -ms-transform: scale(.3);
22 | transform: scale(.3);
23 | }
24 |
25 | 50% {
26 | opacity: 1;
27 | -webkit-transform: scale(1.05);
28 | -ms-transform: scale(1.05);
29 | transform: scale(1.05);
30 | }
31 |
32 | 70% {
33 | -webkit-transform: scale(.9);
34 | -ms-transform: scale(.9);
35 | transform: scale(.9);
36 | }
37 |
38 | 100% {
39 | opacity: 1;
40 | -webkit-transform: scale(1);
41 | -ms-transform: scale(1);
42 | transform: scale(1);
43 | }
44 | }
45 | #gritter-notice-wrapper.top-left {
46 | left: 20px;
47 | right: auto;
48 | }
49 | #gritter-notice-wrapper.bottom-right {
50 | top: auto;
51 | left: auto;
52 | bottom: 20px;
53 | right: 20px;
54 | }
55 | #gritter-notice-wrapper.bottom-left {
56 | top: auto;
57 | right: auto;
58 | bottom: 20px;
59 | left: 20px;
60 | }
61 | .gritter-item-wrapper {
62 | position:relative;
63 | margin:0 0 10px 0;
64 | background:url('images/ie-spacer.gif'); /* ie7/8 fix */
65 | }
66 |
67 | .hover .gritter-top {
68 | /*background-position:right -30px;*/
69 | }
70 | .gritter-bottom {
71 | height:8px;
72 | margin:0;
73 | }
74 |
75 | .gritter-item {
76 | display:block;
77 | background-color: rgba(39,58,75,0.8);
78 | border-radius: 4px;
79 | color:#eee;
80 | padding:10px 11px 10px 11px;
81 | font-size: 11px;
82 | }
83 | .hover .gritter-item {
84 | background-position:right -40px;
85 | }
86 | .gritter-item p {
87 | padding:0;
88 | margin:0;
89 | word-wrap:break-word;
90 | }
91 |
92 | .gritter-item a:hover {
93 | color: #f8ac59;
94 | text-decoration: underline;
95 | }
96 | .gritter-close {
97 | display:none;
98 | position:absolute;
99 | top:5px;
100 | right:3px;
101 | background:url(images/gritter.png) no-repeat left top;
102 | cursor:pointer;
103 | width:30px;
104 | height:30px;
105 | text-indent:-9999em;
106 | }
107 | .gritter-title {
108 | font-size:12px;
109 | font-weight:bold;
110 | padding:0 0 7px 0;
111 | display:block;
112 | text-transform: uppercase;
113 | }
114 | .gritter-image {
115 | width:48px;
116 | height:48px;
117 | float:left;
118 | }
119 | .gritter-with-image,
120 | .gritter-without-image {
121 | padding:0;
122 | }
123 | .gritter-with-image {
124 | width:220px;
125 | float:right;
126 | }
127 | /* for the light (white) version of the gritter notice */
128 | .gritter-light .gritter-item,
129 | .gritter-light .gritter-bottom,
130 | .gritter-light .gritter-top,
131 | .gritter-light .gritter-close {
132 | background-image: url(images/gritter-light.png);
133 | color: #222;
134 | }
135 | .gritter-light .gritter-title {
136 | text-shadow: none;
137 | }
138 |
--------------------------------------------------------------------------------
/static/js/plugins/peity/jquery.peity.min.js:
--------------------------------------------------------------------------------
1 | // Peity jQuery plugin version 2.0.3
2 | // (c) 2014 Ben Pickles
3 | //
4 | // http://benpickles.github.io/peity
5 | //
6 | // Released under MIT license.
7 | (function(e,q,h){var o=function(a,b){var c=q.createElementNS("http://www.w3.org/2000/svg",a);e.each(b,function(a,b){c.setAttribute(a,b)});return c},t="createElementNS"in q&&o("svg",{}).createSVGRect,r=1/(window.devicePixelRatio||1),j=e.fn.peity=function(a,b){t&&this.each(function(){var c=e(this),d=c.data("peity");if(d)a&&(d.type=a),e.extend(d.opts,b);else{var f=j.defaults[a],g={};e.each(c.data(),function(a,b){a in f&&(g[a]=b)});var h=e.extend({},f,g,b),d=new s(c,a,h);c.change(function(){d.draw()}).data("peity",
8 | d)}d.draw()});return this},s=function(a,b,c){this.$el=a;this.type=b;this.opts=c},m=s.prototype;m.draw=function(){j.graphers[this.type].call(this,this.opts)};m.fill=function(){var a=this.opts.fill,b=a;e.isFunction(b)||(b=function(b,d){return a[d%a.length]});return b};m.prepare=function(a,b){var c;this.svg?c=e(this.svg).empty():(this.svg=o("svg",{"class":"peity"}),this.$el.hide().after(this.svg),c=e(this.svg).data("peity",this));this.svg.setAttribute("height",b);this.svg.setAttribute("width",a);return c};
9 | m.values=function(){return e.map(this.$el.text().split(this.opts.delimiter),function(a){return parseFloat(a)})};j.defaults={};j.graphers={};j.register=function(a,b,c){this.defaults[a]=b;this.graphers[a]=c};j.register("pie",{delimiter:null,diameter:16,fill:["#ff9900","#fff4dd","#ffc66e"]},function(a){if(!a.delimiter){var b=this.$el.text().match(/[^0-9\.]/);a.delimiter=b?b[0]:","}b=this.values();if("/"==a.delimiter)var c=b[0],b=[c,h.max(0,b[1]-c)];for(var d=0,c=b.length,f=0;de?1:0,1,q,r,"Z"].join(" ")});i=l}k.setAttribute("fill",j.call(this,n,d,b));this.svg.appendChild(k)}}});j.register("line",{delimiter:",",fill:"#c6d9fd",height:16,max:null,
11 | min:0,stroke:"#4d89f9",strokeWidth:1,width:32},function(a){var b=this.values();1==b.length&&b.push(b[0]);for(var c=h.max.apply(h,b.concat([a.max])),d=h.min.apply(h,b.concat([a.min])),f=this.prepare(a.width,a.height),g=f.width(),f=f.height()-a.strokeWidth,e=g/(b.length-1),c=c-d,j=0==c?f:f/c,m=f+d*j,c=[0,m],i=0;i=d&&0k&&(l+=k,k=-k);n=o("rect",{fill:m.call(this,n,i,b),x:i*g,y:l,width:g-a,height:k});this.svg.appendChild(n)}})})(jQuery,document,Math);
14 |
--------------------------------------------------------------------------------
/static/js/demo/morris-demo.js:
--------------------------------------------------------------------------------
1 | $(function() {
2 |
3 | Morris.Line({
4 | element: 'morris-one-line-chart',
5 | data: [
6 | { year: '2008', value: 5 },
7 | { year: '2009', value: 10 },
8 | { year: '2010', value: 8 },
9 | { year: '2011', value: 22 },
10 | { year: '2012', value: 8 },
11 | { year: '2014', value: 10 },
12 | { year: '2015', value: 5 }
13 | ],
14 | xkey: 'year',
15 | ykeys: ['value'],
16 | resize: true,
17 | lineWidth:4,
18 | labels: ['Value'],
19 | lineColors: ['#1ab394'],
20 | pointSize:5,
21 | });
22 |
23 | Morris.Area({
24 | element: 'morris-area-chart',
25 | data: [{ period: '2010 Q1', iphone: 2666, ipad: null, itouch: 2647 },
26 | { period: '2010 Q2', iphone: 2778, ipad: 2294, itouch: 2441 },
27 | { period: '2010 Q3', iphone: 4912, ipad: 1969, itouch: 2501 },
28 | { period: '2010 Q4', iphone: 3767, ipad: 3597, itouch: 5689 },
29 | { period: '2011 Q1', iphone: 6810, ipad: 1914, itouch: 2293 },
30 | { period: '2011 Q2', iphone: 5670, ipad: 4293, itouch: 1881 },
31 | { period: '2011 Q3', iphone: 4820, ipad: 3795, itouch: 1588 },
32 | { period: '2011 Q4', iphone: 15073, ipad: 5967, itouch: 5175 },
33 | { period: '2012 Q1', iphone: 10687, ipad: 4460, itouch: 2028 },
34 | { period: '2012 Q2', iphone: 8432, ipad: 5713, itouch: 1791 } ],
35 | xkey: 'period',
36 | ykeys: ['iphone', 'ipad', 'itouch'],
37 | labels: ['iPhone', 'iPad', 'iPod Touch'],
38 | pointSize: 2,
39 | hideHover: 'auto',
40 | resize: true,
41 | lineColors: ['#87d6c6', '#54cdb4','#1ab394'],
42 | lineWidth:2,
43 | pointSize:1,
44 | });
45 |
46 | Morris.Donut({
47 | element: 'morris-donut-chart',
48 | data: [{ label: "Download Sales", value: 12 },
49 | { label: "In-Store Sales", value: 30 },
50 | { label: "Mail-Order Sales", value: 20 } ],
51 | resize: true,
52 | colors: ['#87d6c6', '#54cdb4','#1ab394'],
53 | });
54 |
55 | Morris.Bar({
56 | element: 'morris-bar-chart',
57 | data: [{ y: '2006', a: 60, b: 50 },
58 | { y: '2007', a: 75, b: 65 },
59 | { y: '2008', a: 50, b: 40 },
60 | { y: '2009', a: 75, b: 65 },
61 | { y: '2010', a: 50, b: 40 },
62 | { y: '2011', a: 75, b: 65 },
63 | { y: '2012', a: 100, b: 90 } ],
64 | xkey: 'y',
65 | ykeys: ['a', 'b'],
66 | labels: ['Series A', 'Series B'],
67 | hideHover: 'auto',
68 | resize: true,
69 | barColors: ['#1ab394', '#cacaca'],
70 | });
71 |
72 | Morris.Line({
73 | element: 'morris-line-chart',
74 | data: [{ y: '2006', a: 100, b: 90 },
75 | { y: '2007', a: 75, b: 65 },
76 | { y: '2008', a: 50, b: 40 },
77 | { y: '2009', a: 75, b: 65 },
78 | { y: '2010', a: 50, b: 40 },
79 | { y: '2011', a: 75, b: 65 },
80 | { y: '2012', a: 100, b: 90 } ],
81 | xkey: 'y',
82 | ykeys: ['a', 'b'],
83 | labels: ['Series A', 'Series B'],
84 | hideHover: 'auto',
85 | resize: true,
86 | lineColors: ['#54cdb4','#1ab394'],
87 | });
88 |
89 | });
90 |
--------------------------------------------------------------------------------
/static/js/plugins/flot/jquery.flot.resize.js:
--------------------------------------------------------------------------------
1 | /* Flot plugin for automatically redrawing plots as the placeholder resizes.
2 |
3 | Copyright (c) 2007-2014 IOLA and Ole Laursen.
4 | Licensed under the MIT license.
5 |
6 | It works by listening for changes on the placeholder div (through the jQuery
7 | resize event plugin) - if the size changes, it will redraw the plot.
8 |
9 | There are no options. If you need to disable the plugin for some plots, you
10 | can just fix the size of their placeholders.
11 |
12 | */
13 |
14 | /* Inline dependency:
15 | * jQuery resize event - v1.1 - 3/14/2010
16 | * http://benalman.com/projects/jquery-resize-plugin/
17 | *
18 | * Copyright (c) 2010 "Cowboy" Ben Alman
19 | * Dual licensed under the MIT and GPL licenses.
20 | * http://benalman.com/about/license/
21 | */
22 | (function($,e,t){"$:nomunge";var i=[],n=$.resize=$.extend($.resize,{}),a,r=false,s="setTimeout",u="resize",m=u+"-special-event",o="pendingDelay",l="activeDelay",f="throttleWindow";n[o]=200;n[l]=20;n[f]=true;$.event.special[u]={setup:function(){if(!n[f]&&this[s]){return false}var e=$(this);i.push(this);e.data(m,{w:e.width(),h:e.height()});if(i.length===1){a=t;h()}},teardown:function(){if(!n[f]&&this[s]){return false}var e=$(this);for(var t=i.length-1;t>=0;t--){if(i[t]==this){i.splice(t,1);break}}e.removeData(m);if(!i.length){if(r){cancelAnimationFrame(a)}else{clearTimeout(a)}a=null}},add:function(e){if(!n[f]&&this[s]){return false}var i;function a(e,n,a){var r=$(this),s=r.data(m)||{};s.w=n!==t?n:r.width();s.h=a!==t?a:r.height();i.apply(this,arguments)}if($.isFunction(e)){i=e;return a}else{i=e.handler;e.handler=a}}};function h(t){if(r===true){r=t||1}for(var s=i.length-1;s>=0;s--){var l=$(i[s]);if(l[0]==e||l.is(":visible")){var f=l.width(),c=l.height(),d=l.data(m);if(d&&(f!==d.w||c!==d.h)){l.trigger(u,[d.w=f,d.h=c]);r=t||true}}else{d=l.data(m);d.w=0;d.h=0}}if(a!==null){if(r&&(t==null||t-r<1e3)){a=e.requestAnimationFrame(h)}else{a=setTimeout(h,n[o]);r=false}}}if(!e.requestAnimationFrame){e.requestAnimationFrame=function(){return e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.oRequestAnimationFrame||e.msRequestAnimationFrame||function(t,i){return e.setTimeout(function(){t((new Date).getTime())},n[l])}}()}if(!e.cancelAnimationFrame){e.cancelAnimationFrame=function(){return e.webkitCancelRequestAnimationFrame||e.mozCancelRequestAnimationFrame||e.oCancelRequestAnimationFrame||e.msCancelRequestAnimationFrame||clearTimeout}()}})(jQuery,this);
23 |
24 | (function ($) {
25 | var options = { }; // no options
26 |
27 | function init(plot) {
28 | function onResize() {
29 | var placeholder = plot.getPlaceholder();
30 |
31 | // somebody might have hidden us and we can't plot
32 | // when we don't have the dimensions
33 | if (placeholder.width() == 0 || placeholder.height() == 0)
34 | return;
35 |
36 | plot.resize();
37 | plot.setupGrid();
38 | plot.draw();
39 | }
40 |
41 | function bindEvents(plot, eventHolder) {
42 | plot.getPlaceholder().resize(onResize);
43 | }
44 |
45 | function shutdown(plot, eventHolder) {
46 | plot.getPlaceholder().unbind("resize", onResize);
47 | }
48 |
49 | plot.hooks.bindEvents.push(bindEvents);
50 | plot.hooks.shutdown.push(shutdown);
51 | }
52 |
53 | $.plot.plugins.push({
54 | init: init,
55 | options: options,
56 | name: 'resize',
57 | version: '1.0'
58 | });
59 | })(jQuery);
60 |
--------------------------------------------------------------------------------
/static/js/demo/rickshaw-demo.js:
--------------------------------------------------------------------------------
1 | $(function() {
2 | var graph = new Rickshaw.Graph( {
3 | element: document.querySelector("#chart"),
4 | series: [{
5 | color: '#1ab394',
6 | data: [
7 | { x: 0, y: 40 },
8 | { x: 1, y: 49 },
9 | { x: 2, y: 38 },
10 | { x: 3, y: 30 },
11 | { x: 4, y: 32 } ]
12 | }]
13 | });
14 | graph.render();
15 |
16 | var graph2 = new Rickshaw.Graph( {
17 | element: document.querySelector("#rickshaw_multi"),
18 | renderer: 'area',
19 | stroke: true,
20 | series: [ {
21 | data: [ { x: 0, y: 40 }, { x: 1, y: 49 }, { x: 2, y: 38 }, { x: 3, y: 20 }, { x: 4, y: 16 } ],
22 | color: '#1ab394',
23 | stroke: '#17997f'
24 | }, {
25 | data: [ { x: 0, y: 22 }, { x: 1, y: 25 }, { x: 2, y: 38 }, { x: 3, y: 44 }, { x: 4, y: 46 } ],
26 | color: '#eeeeee',
27 | stroke: '#d7d7d7'
28 | } ]
29 | } );
30 | graph2.renderer.unstack = true;
31 | graph2.render();
32 |
33 | var graph3 = new Rickshaw.Graph({
34 | element: document.querySelector("#rickshaw_line"),
35 | renderer: 'line',
36 | series: [ {
37 | data: [ { x: 0, y: 40 }, { x: 1, y: 49 }, { x: 2, y: 38 }, { x: 3, y: 30 }, { x: 4, y: 32 } ],
38 | color: '#1ab394'
39 | } ]
40 | } );
41 | graph3.render();
42 |
43 | var graph4 = new Rickshaw.Graph({
44 | element: document.querySelector("#rickshaw_multi_line"),
45 | renderer: 'line',
46 | series: [{
47 | data: [ { x: 0, y: 40 }, { x: 1, y: 49 }, { x: 2, y: 38 }, { x: 3, y: 30 }, { x: 4, y: 32 } ],
48 | color: '#1ab394'
49 | }, {
50 | data: [ { x: 0, y: 20 }, { x: 1, y: 24 }, { x: 2, y: 19 }, { x: 3, y: 15 }, { x: 4, y: 16 } ],
51 | color: '#d7d7d7'
52 | }]
53 | });
54 | graph4.render();
55 |
56 | var graph5 = new Rickshaw.Graph( {
57 | element: document.querySelector("#rickshaw_bars"),
58 | renderer: 'bar',
59 | series: [ {
60 | data: [ { x: 0, y: 40 }, { x: 1, y: 49 }, { x: 2, y: 38 }, { x: 3, y: 30 }, { x: 4, y: 32 } ],
61 | color: '#1ab394'
62 | } ]
63 | } );
64 | graph5.render();
65 |
66 | var graph6 = new Rickshaw.Graph( {
67 | element: document.querySelector("#rickshaw_bars_stacked"),
68 | renderer: 'bar',
69 | series: [
70 | {
71 | data: [ { x: 0, y: 40 }, { x: 1, y: 49 }, { x: 2, y: 38 }, { x: 3, y: 30 }, { x: 4, y: 32 } ],
72 | color: '#1ab394'
73 | }, {
74 | data: [ { x: 0, y: 20 }, { x: 1, y: 24 }, { x: 2, y: 19 }, { x: 3, y: 15 }, { x: 4, y: 16 } ],
75 | color: '#d7d7d7'
76 | } ]
77 | } );
78 | graph6.render();
79 |
80 | var graph7 = new Rickshaw.Graph( {
81 | element: document.querySelector("#rickshaw_scatterplot"),
82 | renderer: 'scatterplot',
83 | stroke: true,
84 | padding: { top: 0.05, left: 0.05, right: 0.05 },
85 | series: [ {
86 | data: [ { x: 0, y: 15 },
87 | { x: 1, y: 18 },
88 | { x: 2, y: 10 },
89 | { x: 3, y: 12 },
90 | { x: 4, y: 15 },
91 | { x: 5, y: 24 },
92 | { x: 6, y: 28 },
93 | { x: 7, y: 31 },
94 | { x: 8, y: 22 },
95 | { x: 9, y: 18 },
96 | { x: 10, y: 16 }
97 | ],
98 | color: '#1ab394'
99 | } ]
100 | } );
101 | graph7.render();
102 |
103 | });
--------------------------------------------------------------------------------
/static/js/plugins/flot/jquery.flot.tooltip.min.js:
--------------------------------------------------------------------------------
1 | /*
2 | * jquery.flot.tooltip
3 | *
4 | * description: easy-to-use tooltips for Flot charts
5 | * version: 0.6.2
6 | * author: Krzysztof Urbas @krzysu [myviews.pl]
7 | * website: https://github.com/krzysu/flot.tooltip
8 | *
9 | * build on 2013-09-30
10 | * released under MIT License, 2012
11 | */
12 | (function(t){var o={tooltip:!1,tooltipOpts:{content:"%s | X: %x | Y: %y",xDateFormat:null,yDateFormat:null,shifts:{x:10,y:20},defaultTheme:!0,onHover:function(){}}},i=function(t){this.tipPosition={x:0,y:0},this.init(t)};i.prototype.init=function(o){function i(t){var o={};o.x=t.pageX,o.y=t.pageY,s.updateTooltipPosition(o)}function e(t,o,i){var e=s.getDomElement();if(i){var n;n=s.stringFormat(s.tooltipOptions.content,i),e.html(n),s.updateTooltipPosition({x:o.pageX,y:o.pageY}),e.css({left:s.tipPosition.x+s.tooltipOptions.shifts.x,top:s.tipPosition.y+s.tooltipOptions.shifts.y}).show(),"function"==typeof s.tooltipOptions.onHover&&s.tooltipOptions.onHover(i,e)}else e.hide().html("")}var s=this;o.hooks.bindEvents.push(function(o,n){s.plotOptions=o.getOptions(),s.plotOptions.tooltip!==!1&&void 0!==s.plotOptions.tooltip&&(s.tooltipOptions=s.plotOptions.tooltipOpts,s.getDomElement(),t(o.getPlaceholder()).bind("plothover",e),t(n).bind("mousemove",i))}),o.hooks.shutdown.push(function(o,s){t(o.getPlaceholder()).unbind("plothover",e),t(s).unbind("mousemove",i)})},i.prototype.getDomElement=function(){var o;return t("#flotTip").length>0?o=t("#flotTip"):(o=t("").attr("id","flotTip"),o.appendTo("body").hide().css({position:"absolute"}),this.tooltipOptions.defaultTheme&&o.css({background:"#fff","z-index":"100",padding:"0.4em 0.6em","border-radius":"0.5em","font-size":"0.8em",border:"1px solid #111",display:"none","white-space":"nowrap"})),o},i.prototype.updateTooltipPosition=function(o){var i=t("#flotTip").outerWidth()+this.tooltipOptions.shifts.x,e=t("#flotTip").outerHeight()+this.tooltipOptions.shifts.y;o.x-t(window).scrollLeft()>t(window).innerWidth()-i&&(o.x-=i),o.y-t(window).scrollTop()>t(window).innerHeight()-e&&(o.y-=e),this.tipPosition.x=o.x,this.tipPosition.y=o.y},i.prototype.stringFormat=function(t,o){var i=/%p\.{0,1}(\d{0,})/,e=/%s/,s=/%x\.{0,1}(?:\d{0,})/,n=/%y\.{0,1}(?:\d{0,})/;return"function"==typeof t&&(t=t(o.series.label,o.series.data[o.dataIndex][0],o.series.data[o.dataIndex][1],o)),o.series.percent!==void 0&&(t=this.adjustValPrecision(i,t,o.series.percent)),o.series.label!==void 0&&(t=t.replace(e,o.series.label)),this.isTimeMode("xaxis",o)&&this.isXDateFormat(o)&&(t=t.replace(s,this.timestampToDate(o.series.data[o.dataIndex][0],this.tooltipOptions.xDateFormat))),this.isTimeMode("yaxis",o)&&this.isYDateFormat(o)&&(t=t.replace(n,this.timestampToDate(o.series.data[o.dataIndex][1],this.tooltipOptions.yDateFormat))),"number"==typeof o.series.data[o.dataIndex][0]&&(t=this.adjustValPrecision(s,t,o.series.data[o.dataIndex][0])),"number"==typeof o.series.data[o.dataIndex][1]&&(t=this.adjustValPrecision(n,t,o.series.data[o.dataIndex][1])),o.series.xaxis.tickFormatter!==void 0&&(t=t.replace(s,o.series.xaxis.tickFormatter(o.series.data[o.dataIndex][0],o.series.xaxis))),o.series.yaxis.tickFormatter!==void 0&&(t=t.replace(n,o.series.yaxis.tickFormatter(o.series.data[o.dataIndex][1],o.series.yaxis))),t},i.prototype.isTimeMode=function(t,o){return o.series[t].options.mode!==void 0&&"time"===o.series[t].options.mode},i.prototype.isXDateFormat=function(){return this.tooltipOptions.xDateFormat!==void 0&&null!==this.tooltipOptions.xDateFormat},i.prototype.isYDateFormat=function(){return this.tooltipOptions.yDateFormat!==void 0&&null!==this.tooltipOptions.yDateFormat},i.prototype.timestampToDate=function(o,i){var e=new Date(o);return t.plot.formatDate(e,i)},i.prototype.adjustValPrecision=function(t,o,i){var e,s=o.match(t);return null!==s&&""!==RegExp.$1&&(e=RegExp.$1,i=i.toFixed(e),o=o.replace(t,i)),o};var e=function(t){new i(t)};t.plot.plugins.push({init:e,options:o,name:"tooltip",version:"0.6.1"})})(jQuery);
--------------------------------------------------------------------------------
/static/js/plugins/toastr/toastr.min.js:
--------------------------------------------------------------------------------
1 | !function(e){e(["jquery"],function(e){return function(){function t(e,t,n){return f({type:O.error,iconClass:g().iconClasses.error,message:e,optionsOverride:n,title:t})}function n(t,n){return t||(t=g()),v=e("#"+t.containerId),v.length?v:(n&&(v=c(t)),v)}function i(e,t,n){return f({type:O.info,iconClass:g().iconClasses.info,message:e,optionsOverride:n,title:t})}function o(e){w=e}function s(e,t,n){return f({type:O.success,iconClass:g().iconClasses.success,message:e,optionsOverride:n,title:t})}function a(e,t,n){return f({type:O.warning,iconClass:g().iconClasses.warning,message:e,optionsOverride:n,title:t})}function r(e){var t=g();v||n(t),l(e,t)||u(t)}function d(t){var i=g();return v||n(i),t&&0===e(":focus",t).length?void h(t):void(v.children().length&&v.remove())}function u(t){for(var n=v.children(),i=n.length-1;i>=0;i--)l(e(n[i]),t)}function l(t,n){return t&&0===e(":focus",t).length?(t[n.hideMethod]({duration:n.hideDuration,easing:n.hideEasing,complete:function(){h(t)}}),!0):!1}function c(t){return v=e("").attr("id",t.containerId).addClass(t.positionClass).attr("aria-live","polite").attr("role","alert"),v.appendTo(e(t.target)),v}function p(){return{tapToDismiss:!0,toastClass:"toast",containerId:"toast-container",debug:!1,showMethod:"fadeIn",showDuration:300,showEasing:"swing",onShown:void 0,hideMethod:"fadeOut",hideDuration:1e3,hideEasing:"swing",onHidden:void 0,extendedTimeOut:1e3,iconClasses:{error:"toast-error",info:"toast-info",success:"toast-success",warning:"toast-warning"},iconClass:"toast-info",positionClass:"toast-top-right",timeOut:5e3,titleClass:"toast-title",messageClass:"toast-message",target:"body",closeHtml:'',newestOnTop:!0,preventDuplicates:!1,progressBar:!1}}function m(e){w&&w(e)}function f(t){function i(t){return!e(":focus",l).length||t?(clearTimeout(O.intervalId),l[r.hideMethod]({duration:r.hideDuration,easing:r.hideEasing,complete:function(){h(l),r.onHidden&&"hidden"!==b.state&&r.onHidden(),b.state="hidden",b.endTime=new Date,m(b)}})):void 0}function o(){(r.timeOut>0||r.extendedTimeOut>0)&&(u=setTimeout(i,r.extendedTimeOut),O.maxHideTime=parseFloat(r.extendedTimeOut),O.hideEta=(new Date).getTime()+O.maxHideTime)}function s(){clearTimeout(u),O.hideEta=0,l.stop(!0,!0)[r.showMethod]({duration:r.showDuration,easing:r.showEasing})}function a(){var e=(O.hideEta-(new Date).getTime())/O.maxHideTime*100;f.width(e+"%")}var r=g(),d=t.iconClass||r.iconClass;if("undefined"!=typeof t.optionsOverride&&(r=e.extend(r,t.optionsOverride),d=t.optionsOverride.iconClass||d),r.preventDuplicates){if(t.message===C)return;C=t.message}T++,v=n(r,!0);var u=null,l=e(""),c=e(""),p=e(""),f=e(""),w=e(r.closeHtml),O={intervalId:null,hideEta:null,maxHideTime:null},b={toastId:T,state:"visible",startTime:new Date,options:r,map:t};return t.iconClass&&l.addClass(r.toastClass).addClass(d),t.title&&(c.append(t.title).addClass(r.titleClass),l.append(c)),t.message&&(p.append(t.message).addClass(r.messageClass),l.append(p)),r.closeButton&&(w.addClass("toast-close-button").attr("role","button"),l.prepend(w)),r.progressBar&&(f.addClass("toast-progress"),l.prepend(f)),l.hide(),r.newestOnTop?v.prepend(l):v.append(l),l[r.showMethod]({duration:r.showDuration,easing:r.showEasing,complete:r.onShown}),r.timeOut>0&&(u=setTimeout(i,r.timeOut),O.maxHideTime=parseFloat(r.timeOut),O.hideEta=(new Date).getTime()+O.maxHideTime,r.progressBar&&(O.intervalId=setInterval(a,10))),l.hover(s,o),!r.onclick&&r.tapToDismiss&&l.click(i),r.closeButton&&w&&w.click(function(e){e.stopPropagation?e.stopPropagation():void 0!==e.cancelBubble&&e.cancelBubble!==!0&&(e.cancelBubble=!0),i(!0)}),r.onclick&&l.click(function(){r.onclick(),i()}),m(b),r.debug&&console&&console.log(b),l}function g(){return e.extend({},p(),b.options)}function h(e){v||(v=n()),e.is(":visible")||(e.remove(),e=null,0===v.children().length&&(v.remove(),C=void 0))}var v,w,C,T=0,O={error:"error",info:"info",success:"success",warning:"warning"},b={clear:r,remove:d,error:t,getContainer:n,info:i,options:{},subscribe:o,success:s,version:"2.1.0",warning:a};return b}()})}("function"==typeof define&&define.amd?define:function(e,t){"undefined"!=typeof module&&module.exports?module.exports=t(require("jquery")):window.toastr=t(window.jQuery)});
2 | //# sourceMappingURL=/toastr.js.map
--------------------------------------------------------------------------------
/static/js/plugins/gritter/jquery.gritter.min.js:
--------------------------------------------------------------------------------
1 | (function(b){b.gritter={};b.gritter.options={position:"",class_name:"",fade_in_speed:"medium",fade_out_speed:1000,time:6000};b.gritter.add=function(f){try{return a.add(f||{})}catch(d){var c="Gritter Error: "+d;(typeof(console)!="undefined"&&console.error)?console.error(c,f):alert(c)}};b.gritter.remove=function(d,c){a.removeSpecific(d,c||{})};b.gritter.removeAll=function(c){a.stop(c||{})};var a={position:"",fade_in_speed:"",fade_out_speed:"",time:"",_custom_timer:0,_item_count:0,_is_setup:0,_tpl_close:'Close Notification',_tpl_title:'[[title]]',_tpl_item:'',_tpl_wrap:'',add:function(g){if(typeof(g)=="string"){g={text:g}}if(g.text===null){throw'You must supply "text" parameter.'}if(!this._is_setup){this._runSetup()}var k=g.title,n=g.text,e=g.image||"",l=g.sticky||false,m=g.class_name||b.gritter.options.class_name,j=b.gritter.options.position,d=g.time||"";this._verifyWrapper();this._item_count++;var f=this._item_count,i=this._tpl_item;b(["before_open","after_open","before_close","after_close"]).each(function(p,q){a["_"+q+"_"+f]=(b.isFunction(g[q]))?g[q]:function(){}});this._custom_timer=0;if(d){this._custom_timer=d}var c=(e!="")?'
':"",h=(e!="")?"gritter-with-image":"gritter-without-image";if(k){k=this._str_replace("[[title]]",k,this._tpl_title)}else{k=""}i=this._str_replace(["[[title]]","[[text]]","[[close]]","[[image]]","[[number]]","[[class_name]]","[[item_class]]"],[k,n,this._tpl_close,c,this._item_count,h,m],i);if(this["_before_open_"+f]()===false){return false}b("#gritter-notice-wrapper").addClass(j).append(i);var o=b("#gritter-item-"+this._item_count);o.fadeIn(this.fade_in_speed,function(){a["_after_open_"+f](b(this))});if(!l){this._setFadeTimer(o,f)}b(o).bind("mouseenter mouseleave",function(p){if(p.type=="mouseenter"){if(!l){a._restoreItemIfFading(b(this),f)}}else{if(!l){a._setFadeTimer(b(this),f)}}a._hoverState(b(this),p.type)});b(o).find(".gritter-close").click(function(){a.removeSpecific(f,{},null,true);return false;});return f},_countRemoveWrapper:function(c,d,f){d.remove();this["_after_close_"+c](d,f);if(b(".gritter-item-wrapper").length==0){b("#gritter-notice-wrapper").remove()}},_fade:function(g,d,j,f){var j=j||{},i=(typeof(j.fade)!="undefined")?j.fade:true,c=j.speed||this.fade_out_speed,h=f;this["_before_close_"+d](g,h);if(f){g.unbind("mouseenter mouseleave")}if(i){g.animate({opacity:0},c,function(){g.animate({height:0},300,function(){a._countRemoveWrapper(d,g,h)})})}else{this._countRemoveWrapper(d,g)}},_hoverState:function(d,c){if(c=="mouseenter"){d.addClass("hover");d.find(".gritter-close").show()}else{d.removeClass("hover");d.find(".gritter-close").hide()}},removeSpecific:function(c,g,f,d){if(!f){var f=b("#gritter-item-"+c)}this._fade(f,c,g||{},d)},_restoreItemIfFading:function(d,c){clearTimeout(this["_int_id_"+c]);d.stop().css({opacity:"",height:""})},_runSetup:function(){for(opt in b.gritter.options){this[opt]=b.gritter.options[opt]}this._is_setup=1},_setFadeTimer:function(f,d){var c=(this._custom_timer)?this._custom_timer:this.time;this["_int_id_"+d]=setTimeout(function(){a._fade(f,d)},c)},stop:function(e){var c=(b.isFunction(e.before_close))?e.before_close:function(){};var f=(b.isFunction(e.after_close))?e.after_close:function(){};var d=b("#gritter-notice-wrapper");c(d);d.fadeOut(function(){b(this).remove();f()})},_str_replace:function(v,e,o,n){var k=0,h=0,t="",m="",g=0,q=0,l=[].concat(v),c=[].concat(e),u=o,d=c instanceof Array,p=u instanceof Array;u=[].concat(u);if(n){this.window[n]=0}for(k=0,g=u.length;k
2 |
3 |
4 |
5 | delete rules
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
删除告警规则
17 |
18 |
19 |
20 |
21 |
24 |
25 |
26 |
31 |
32 |
33 |
34 |
35 |
36 |
告警规则预览:
37 |
groups:
38 |
- name:
39 |
rules:
40 |
- alert:
41 |
expr:
42 |
for:
43 |
labels:
44 |
level:
45 |
service:
46 |
annotations:
47 |
summary: "告警主机和端口{{ $labels.instance }} 告警值:{{ $value }}"
48 |
description:
49 |
50 |
51 |
52 |
53 |
54 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
--------------------------------------------------------------------------------
/static/js/plugins/slimscroll/jquery.slimscroll.min.js:
--------------------------------------------------------------------------------
1 | /*! Copyright (c) 2011 Piotr Rochala (http://rocha.la)
2 | * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
3 | * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
4 | *
5 | * Version: 1.3.6
6 | *
7 | */
8 | (function(e){e.fn.extend({slimScroll:function(g){var a=e.extend({width:"auto",height:"250px",size:"7px",color:"#000",position:"right",distance:"1px",start:"top",opacity:.4,alwaysVisible:!1,disableFadeOut:!1,railVisible:!1,railColor:"#333",railOpacity:.2,railDraggable:!0,railClass:"slimScrollRail",barClass:"slimScrollBar",wrapperClass:"slimScrollDiv",allowPageScroll:!1,wheelStep:20,touchScrollStep:200,borderRadius:"7px",railBorderRadius:"7px"},g);this.each(function(){function v(d){if(r){d=d||window.event;
9 | var c=0;d.wheelDelta&&(c=-d.wheelDelta/120);d.detail&&(c=d.detail/3);e(d.target||d.srcTarget||d.srcElement).closest("."+a.wrapperClass).is(b.parent())&&m(c,!0);d.preventDefault&&!k&&d.preventDefault();k||(d.returnValue=!1)}}function m(d,e,g){k=!1;var f=d,h=b.outerHeight()-c.outerHeight();e&&(f=parseInt(c.css("top"))+d*parseInt(a.wheelStep)/100*c.outerHeight(),f=Math.min(Math.max(f,0),h),f=0=b.outerHeight()?k=!0:(c.stop(!0,
11 | !0).fadeIn("fast"),a.railVisible&&h.stop(!0,!0).fadeIn("fast"))}function p(){a.alwaysVisible||(B=setTimeout(function(){a.disableFadeOut&&r||y||z||(c.fadeOut("slow"),h.fadeOut("slow"))},1E3))}var r,y,z,B,A,u,l,C,k=!1,b=e(this);if(b.parent().hasClass(a.wrapperClass)){var n=b.scrollTop(),c=b.closest("."+a.barClass),h=b.closest("."+a.railClass);x();if(e.isPlainObject(g)){if("height"in g&&"auto"==g.height){b.parent().css("height","auto");b.css("height","auto");var q=b.parent().parent().height();b.parent().css("height",
12 | q);b.css("height",q)}if("scrollTo"in g)n=parseInt(a.scrollTo);else if("scrollBy"in g)n+=parseInt(a.scrollBy);else if("destroy"in g){c.remove();h.remove();b.unwrap();return}m(n,!1,!0)}}else if(!(e.isPlainObject(g)&&"destroy"in g)){a.height="auto"==a.height?b.parent().height():a.height;n=e("").addClass(a.wrapperClass).css({position:"relative",overflow:"hidden",width:a.width,height:a.height});b.css({overflow:"hidden",width:a.width,height:a.height});var h=e("").addClass(a.railClass).css({width:a.size,
13 | height:"100%",position:"absolute",top:0,display:a.alwaysVisible&&a.railVisible?"block":"none","border-radius":a.railBorderRadius,background:a.railColor,opacity:a.railOpacity,zIndex:90}),c=e("").addClass(a.barClass).css({background:a.color,width:a.size,position:"absolute",top:0,opacity:a.opacity,display:a.alwaysVisible?"block":"none","border-radius":a.borderRadius,BorderRadius:a.borderRadius,MozBorderRadius:a.borderRadius,WebkitBorderRadius:a.borderRadius,zIndex:99}),q="right"==a.position?
14 | {right:a.distance}:{left:a.distance};h.css(q);c.css(q);b.wrap(n);b.parent().append(c);b.parent().append(h);a.railDraggable&&c.bind("mousedown",function(a){var b=e(document);z=!0;t=parseFloat(c.css("top"));pageY=a.pageY;b.bind("mousemove.slimscroll",function(a){currTop=t+a.pageY-pageY;c.css("top",currTop);m(0,c.position().top,!1)});b.bind("mouseup.slimscroll",function(a){z=!1;p();b.unbind(".slimscroll")});return!1}).bind("selectstart.slimscroll",function(a){a.stopPropagation();a.preventDefault();return!1});
15 | h.hover(function(){w()},function(){p()});c.hover(function(){y=!0},function(){y=!1});b.hover(function(){r=!0;w();p()},function(){r=!1;p()});b.bind("touchstart",function(a,b){a.originalEvent.touches.length&&(A=a.originalEvent.touches[0].pageY)});b.bind("touchmove",function(b){k||b.originalEvent.preventDefault();b.originalEvent.touches.length&&(m((A-b.originalEvent.touches[0].pageY)/a.touchScrollStep,!0),A=b.originalEvent.touches[0].pageY)});x();"bottom"===a.start?(c.css({top:b.outerHeight()-c.outerHeight()}),
16 | m(0,!0)):"top"!==a.start&&(m(e(a.start).position().top,null,!0),a.alwaysVisible||c.hide());window.addEventListener?(this.addEventListener("DOMMouseScroll",v,!1),this.addEventListener("mousewheel",v,!1)):document.attachEvent("onmousewheel",v)}});return this}});e.fn.extend({slimscroll:e.fn.slimScroll})})(jQuery);
--------------------------------------------------------------------------------
/PrometheusController.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from flask import Flask, request, render_template, make_response, Response
3 | import sys
4 | import json
5 | from PrometheusService import create_rules_model, get_rule, get_rule_detail, update_rules_model, delete_rules_model
6 | import PrometheusConfig
7 | import os
8 |
9 | reload(sys)
10 | sys.setdefaultencoding('utf8')
11 |
12 |
13 | app = Flask(__name__)
14 |
15 |
16 | @app.route('/prometheus/add', methods=['POST'])
17 | def add():
18 | content = json.dumps('创建成功')
19 | try:
20 | name = request.form['name']
21 | expr = request.form['expr']
22 | level = request.form['level']
23 | _for = request.form['_for']
24 | desc = request.form['desc']
25 | model = request.form['model']
26 | service = request.form['service']
27 | rs = create_rules_model(name, expr, level, _for, desc, model, service)
28 | if rs == 1:
29 | return json.dumps('error! please check the path is exist and Permission!')
30 | except Exception, e:
31 | print e
32 | content = json.dumps('error')
33 |
34 | resp = Response(content)
35 | return resp
36 |
37 |
38 | @app.route('/prometheus/update', methods=['POST'])
39 | def update():
40 | content = json.dumps('修改成功')
41 | try:
42 | _name = request.form['_name']
43 | name = request.form['name']
44 | expr = request.form['expr']
45 | level = request.form['level']
46 | _for = request.form['_for']
47 | desc = request.form['desc']
48 | model = request.form['model']
49 | service = request.form['service']
50 | rs = update_rules_model(name, expr, level, _for, desc, model, _name, service)
51 | if rs == 1:
52 | return json.dumps('error! please check the path is exist and Permission!')
53 | except Exception, e:
54 | print e
55 | content = json.dumps('error!')
56 |
57 | resp = Response(content)
58 | return resp
59 |
60 |
61 | @app.route('/prometheus/delete', methods=['POST'])
62 | def delete():
63 | content = json.dumps('删除成功')
64 | try:
65 | _name = request.form['_name']
66 | delete_rules_model(_name)
67 | except Exception, e:
68 | print e
69 | content = json.dumps('error! please check the path is exist and Permission!')
70 | resp = Response(content)
71 | return resp
72 |
73 |
74 | @app.route('/prometheus/getRulesList', methods=['POST'])
75 | def get_rules_list():
76 | try:
77 | content = get_rule()
78 | except Exception, e:
79 | print e
80 | content = []
81 |
82 | resp = Response(json.dumps(content))
83 | return resp
84 |
85 |
86 | @app.route('/prometheus/getRulesDetail', methods=['POST'])
87 | def get_rules_detail():
88 | try:
89 | name = request.form['name']
90 | content = get_rule_detail(name)
91 | except Exception, e:
92 | print e
93 | content = {'name': '', 'alert': '', 'expr': '', '_for': '', 'level': '', 'summary': '', 'description': ''}
94 | resp = Response(json.dumps(content))
95 | return resp
96 |
97 |
98 | @app.route('/', methods=['GET'])
99 | def open_web():
100 | # return render_template('rulesWeb.html')
101 | return app.send_static_file('pages/rulesWeb.html')
102 |
103 |
104 | @app.route('/prometheus/AddRules', methods=['GET'])
105 | def open_html():
106 | # return render_template('rulesWeb.html')
107 | return app.send_static_file('pages/rulesWeb.html')
108 |
109 |
110 | @app.route('/prometheus/UpdateRules')
111 | def update_html():
112 | # return render_template('rulesWeb.html')
113 | return app.send_static_file('pages/update.html')
114 |
115 |
116 | @app.route('/prometheus/GetInfo', methods=['POST'])
117 | def get_info():
118 | result = {}
119 | try:
120 | result['servers'] = PrometheusConfig.services
121 | result['alerm'] = PrometheusConfig.alarms
122 | except Exception, e:
123 | print e
124 | return json.dumps(result)
125 |
126 |
127 | @app.route('/prometheus/refresh', methods=['POST'])
128 | def refresh():
129 | try:
130 | # os.system("curl -X POST --connect-timeout 10 -m 20 http://172.16.0.143:9090/-/reload >/dev/null")
131 | rs = os.popen("curl -X POST --connect-timeout 10 -m 20 http://127.0.0.1:9090/-/reload").read()
132 | if rs.strip() != '':
133 | return json.dumps("refresh fail, please check the prometheus.yml")
134 | return json.dumps("refresh success!")
135 | except Exception, e:
136 | print e
137 | return json.dumps("refresh fail")
138 |
139 | if __name__ == '__main__':
140 | app.run("0.0.0.0", 8888)
141 |
--------------------------------------------------------------------------------
/static/js/plugins/tinycon/tinycon.min.js:
--------------------------------------------------------------------------------
1 | /*!
2 | Tinycon - A small library for manipulating the Favicon
3 | Tom Moor, http://tommoor.com
4 | Copyright (c) 2012 Tom Moor
5 | @license MIT Licensed
6 | @version 0.6.3
7 | */
8 | (function(){var Tinycon={};var currentFavicon=null;var originalFavicon=null;var faviconImage=null;var canvas=null;var options={};var r=window.devicePixelRatio||1;var size=16*r;var defaults={width:7,height:9,font:10*r+'px arial',colour:'#ffffff',background:'#F03D25',fallback:true,crossOrigin:true,abbreviate:true};var ua=(function(){var agent=navigator.userAgent.toLowerCase();return function(browser){return agent.indexOf(browser)!==-1}}());var browser={ie:ua('msie'),chrome:ua('chrome'),webkit:ua('chrome')||ua('safari'),safari:ua('safari')&&!ua('chrome'),mozilla:ua('mozilla')&&!ua('chrome')&&!ua('safari')};var getFaviconTag=function(){var links=document.getElementsByTagName('link');for(var i=0,len=links.length;i0)drawBubble(context,label,colour);refreshFavicon()};if(!src.match(/^data/)&&options.crossOrigin){faviconImage.crossOrigin='anonymous'}faviconImage.src=src};var updateTitle=function(label){if(options.fallback){var originalTitle=document.title;if(originalTitle[0]==='('){originalTitle=originalTitle.slice(originalTitle.indexOf(' '))}if((label+'').length>0){document.title='('+label+') '+originalTitle}else{document.title=originalTitle}}};var drawBubble=function(context,label,colour){if(typeof label=='number'&&label>99&&options.abbreviate){label=abbreviateNumber(label)}var len=(label+'').length-1;var width=options.width*r+(6*r*len),height=options.height*r;var top=size-height,left=size-width-r,bottom=16*r,right=16*r,radius=2*r;context.font=(browser.webkit?'bold ':'')+options.font;context.fillStyle=options.background;context.strokeStyle=options.background;context.lineWidth=r;context.beginPath();context.moveTo(left+radius,top);context.quadraticCurveTo(left,top,left,top+radius);context.lineTo(left,bottom-radius);context.quadraticCurveTo(left,bottom,left+radius,bottom);context.lineTo(right-radius,bottom);context.quadraticCurveTo(right,bottom,right,bottom-radius);context.lineTo(right,top+radius);context.quadraticCurveTo(right,top,right-radius,top);context.closePath();context.fill();context.beginPath();context.strokeStyle="rgba(0,0,0,0.3)";context.moveTo(left+radius/2.0,bottom);context.lineTo(right-radius/2.0,bottom);context.stroke();context.fillStyle=options.colour;context.textAlign="right";context.textBaseline="top";context.fillText(label,r===2?29:15,browser.mozilla?7*r:6*r)};var refreshFavicon=function(){if(!getCanvas().getContext)return;setFaviconTag(getCanvas().toDataURL())};var abbreviateNumber=function(label){var metricPrefixes=[['G',1000000000],['M',1000000],['k',1000]];for(var i=0;i=metricPrefixes[i][1]){label=round(label/metricPrefixes[i][1])+metricPrefixes[i][0];break}}return label};var round=function(value,precision){var number=new Number(value);return number.toFixed(precision)};Tinycon.setOptions=function(custom){options={};for(var key in defaults){options[key]=custom.hasOwnProperty(key)?custom[key]:defaults[key]}return this};Tinycon.setImage=function(url){currentFavicon=url;refreshFavicon();return this};Tinycon.setBubble=function(label,colour){label=label||'';drawFavicon(label,colour);return this};Tinycon.reset=function(){setFaviconTag(originalFavicon)};Tinycon.setOptions(defaults);window.Tinycon=Tinycon;if(typeof define==='function'&&define.amd){define(Tinycon)}})();
--------------------------------------------------------------------------------
/static/js/plugins/iCheck/icheck.min.js:
--------------------------------------------------------------------------------
1 | /*! iCheck v1.0.2 by Damir Sultanov, http://git.io/arlzeA, MIT Licensed */
2 | (function(f){function A(a,b,d){var c=a[0],g=/er/.test(d)?_indeterminate:/bl/.test(d)?n:k,e=d==_update?{checked:c[k],disabled:c[n],indeterminate:"true"==a.attr(_indeterminate)||"false"==a.attr(_determinate)}:c[g];if(/^(ch|di|in)/.test(d)&&!e)x(a,g);else if(/^(un|en|de)/.test(d)&&e)q(a,g);else if(d==_update)for(var f in e)e[f]?x(a,f,!0):q(a,f,!0);else if(!b||"toggle"==d){if(!b)a[_callback]("ifClicked");e?c[_type]!==r&&q(a,g):x(a,g)}}function x(a,b,d){var c=a[0],g=a.parent(),e=b==k,u=b==_indeterminate,
3 | v=b==n,s=u?_determinate:e?y:"enabled",F=l(a,s+t(c[_type])),B=l(a,b+t(c[_type]));if(!0!==c[b]){if(!d&&b==k&&c[_type]==r&&c.name){var w=a.closest("form"),p='input[name="'+c.name+'"]',p=w.length?w.find(p):f(p);p.each(function(){this!==c&&f(this).data(m)&&q(f(this),b)})}u?(c[b]=!0,c[k]&&q(a,k,"force")):(d||(c[b]=!0),e&&c[_indeterminate]&&q(a,_indeterminate,!1));D(a,e,b,d)}c[n]&&l(a,_cursor,!0)&&g.find("."+C).css(_cursor,"default");g[_add](B||l(a,b)||"");g.attr("role")&&!u&&g.attr("aria-"+(v?n:k),"true");
4 | g[_remove](F||l(a,s)||"")}function q(a,b,d){var c=a[0],g=a.parent(),e=b==k,f=b==_indeterminate,m=b==n,s=f?_determinate:e?y:"enabled",q=l(a,s+t(c[_type])),r=l(a,b+t(c[_type]));if(!1!==c[b]){if(f||!d||"force"==d)c[b]=!1;D(a,e,s,d)}!c[n]&&l(a,_cursor,!0)&&g.find("."+C).css(_cursor,"pointer");g[_remove](r||l(a,b)||"");g.attr("role")&&!f&&g.attr("aria-"+(m?n:k),"false");g[_add](q||l(a,s)||"")}function E(a,b){if(a.data(m)){a.parent().html(a.attr("style",a.data(m).s||""));if(b)a[_callback](b);a.off(".i").unwrap();
5 | f(_label+'[for="'+a[0].id+'"]').add(a.closest(_label)).off(".i")}}function l(a,b,f){if(a.data(m))return a.data(m).o[b+(f?"":"Class")]}function t(a){return a.charAt(0).toUpperCase()+a.slice(1)}function D(a,b,f,c){if(!c){if(b)a[_callback]("ifToggled");a[_callback]("ifChanged")[_callback]("if"+t(f))}}var m="iCheck",C=m+"-helper",r="radio",k="checked",y="un"+k,n="disabled";_determinate="determinate";_indeterminate="in"+_determinate;_update="update";_type="type";_click="click";_touch="touchbegin.i touchend.i";
6 | _add="addClass";_remove="removeClass";_callback="trigger";_label="label";_cursor="cursor";_mobile=/ipad|iphone|ipod|android|blackberry|windows phone|opera mini|silk/i.test(navigator.userAgent);f.fn[m]=function(a,b){var d='input[type="checkbox"], input[type="'+r+'"]',c=f(),g=function(a){a.each(function(){var a=f(this);c=a.is(d)?c.add(a):c.add(a.find(d))})};if(/^(check|uncheck|toggle|indeterminate|determinate|disable|enable|update|destroy)$/i.test(a))return a=a.toLowerCase(),g(this),c.each(function(){var c=
7 | f(this);"destroy"==a?E(c,"ifDestroyed"):A(c,!0,a);f.isFunction(b)&&b()});if("object"!=typeof a&&a)return this;var e=f.extend({checkedClass:k,disabledClass:n,indeterminateClass:_indeterminate,labelHover:!0},a),l=e.handle,v=e.hoverClass||"hover",s=e.focusClass||"focus",t=e.activeClass||"active",B=!!e.labelHover,w=e.labelHoverClass||"hover",p=(""+e.increaseArea).replace("%","")|0;if("checkbox"==l||l==r)d='input[type="'+l+'"]';-50>p&&(p=-50);g(this);return c.each(function(){var a=f(this);E(a);var c=this,
8 | b=c.id,g=-p+"%",d=100+2*p+"%",d={position:"absolute",top:g,left:g,display:"block",width:d,height:d,margin:0,padding:0,background:"#fff",border:0,opacity:0},g=_mobile?{position:"absolute",visibility:"hidden"}:p?d:{position:"absolute",opacity:0},l="checkbox"==c[_type]?e.checkboxClass||"icheckbox":e.radioClass||"i"+r,z=f(_label+'[for="'+b+'"]').add(a.closest(_label)),u=!!e.aria,y=m+"-"+Math.random().toString(36).substr(2,6),h='")[_callback]("ifCreated").parent().append(e.insert);d=f('').css(d).appendTo(h);a.data(m,{o:e,s:a.attr("style")}).css(g);e.inheritClass&&h[_add](c.className||"");e.inheritID&&b&&h.attr("id",m+"-"+b);"static"==h.css("position")&&h.css("position","relative");A(a,!0,_update);if(z.length)z.on(_click+".i mouseover.i mouseout.i "+_touch,function(b){var d=b[_type],e=f(this);if(!c[n]){if(d==_click){if(f(b.target).is("a"))return;
10 | A(a,!1,!0)}else B&&(/ut|nd/.test(d)?(h[_remove](v),e[_remove](w)):(h[_add](v),e[_add](w)));if(_mobile)b.stopPropagation();else return!1}});a.on(_click+".i focus.i blur.i keyup.i keydown.i keypress.i",function(b){var d=b[_type];b=b.keyCode;if(d==_click)return!1;if("keydown"==d&&32==b)return c[_type]==r&&c[k]||(c[k]?q(a,k):x(a,k)),!1;if("keyup"==d&&c[_type]==r)!c[k]&&x(a,k);else if(/us|ur/.test(d))h["blur"==d?_remove:_add](s)});d.on(_click+" mousedown mouseup mouseover mouseout "+_touch,function(b){var d=
11 | b[_type],e=/wn|up/.test(d)?t:v;if(!c[n]){if(d==_click)A(a,!1,!0);else{if(/wn|er|in/.test(d))h[_add](e);else h[_remove](e+" "+t);if(z.length&&B&&e==v)z[/ut|nd/.test(d)?_remove:_add](w)}if(_mobile)b.stopPropagation();else return!1}})})}})(window.jQuery||window.Zepto);
12 |
--------------------------------------------------------------------------------
/static/skin-config_files/_tts_browser_center.js:
--------------------------------------------------------------------------------
1 | /* @date:2015-10-13_15_36_35 */
2 | !function(a){function b(){!function(b,c,d,e,f,g,h){function i(a){return function(){return h.push(a,arguments),g}}return b[c]?void(a.__tk__define=a.define):(b[c]=g={args:h=[],config:i(1),use:i(2),on:i(3)},b.TKdefine=i(0),e=d.createElement("script"),e.id=c+"node",e.charset="utf-8",e.async=!0,e.src="//ext.taotaosou.com/browser-static/taobao/sea.js?t=10131536",f=d.getElementById("site-nav")?d.getElementById("site-nav"):d.getElementsByTagName("head")[0],void f.appendChild(e))}(window,"__tk__seajs",document)}function c(a,b){var c,d=document.createElement("script");d.type="text/javascript",d.charset="utf-8",d.src=a,d.async=!0,d.onload=d.onreadystatechange=function(){d.isLoad||d.readyState&&"loaded"!==d.readyState&&"complete"!==d.readyState||(d.isLoad=!0,"function"==typeof b&&b(d),d.onload=d.onreadystatechange=null,d.parentNode.removeChild(d))},c=document.getElementById("site-nav")?document.getElementById("site-nav"):document.body,c.appendChild(d)}function d(){var a="0000000000000001",b=e(),c="";return t&&(t.getAttribute("data-id")&&(a=t.getAttribute("data-id")),t.getAttribute("data-source")&&(b=t.getAttribute("data-source")),t.getAttribute("data-guid")&&(c=t.getAttribute("data-guid"))),{id:a,browser:b,guid:c}}function e(){var b="other";if(q.match(/CoolNovo/))b="CoolNovo";else if(q.match(/MetaSr/))b="sogou";else if(q.match(/QIHU 360EE/))b="360js";else if(q.match(/Chrome/))b="Chrome";else if(q.match(/MSIE/)){var c=/msie ([\d.]+)/gi,d=c.exec(q);b=null!==d?d[0]:"ie"}else"object"==typeof a.external&&a.external.twGetRunPath&&a.external.twGetRunPath.match(/360se/)&&(b="360aq");return b}function f(){for(var a="s-",b=1;32>=b;b++){var c=Math.floor(16*Math.random()).toString(16);a+=c,(8===b||12===b||16===b||20===b)&&(a+="-")}return a}function g(a){var b,c=document.createElement("img");"string"==typeof a&&(a+=a.match(/\?/)?"&t=":"?t=",a+=(new Date).getTime()),c.setAttribute("src",a),c.setAttribute("width",0),c.setAttribute("height",0),c.style.display="none",c.onerror=null,document.getElementById("TK-log")?b=document.getElementById("TK-log"):(b=document.createElement("div"),b.id="TK-log",document.body.appendChild(b)),b.appendChild(c)}function h(){var a="//log.taotaosou.com/browser_statistics.do?",b="";s.match("www.mogujie.com/note/")||s.match("www.mogujie.com/group/topic/")?b="MGJ_Note_PV":s.match("meilishuo.com")&&(b="MLS_Share_PV"),b&&g(a+"type="+b)}function i(){var a="//log.taotaosou.com/ditchSite.do?",b="";r.match(/baidu.com/)?b="baidu.com":r.match(/qq.com/)?b="qq.com":r.match(/taobao.com/)?b="taobao.com":r.match(/tmall.com/)?b="tmall.com":r.match(/4399.com/)?b="4399.com":r.match(/360.cn/)?b="360.cn":r.match(/youku.com/)&&(b="youku.com"),b&&g(a+"ditchId="+d().id+"&fromSite="+b+"&z1_guid="+d().guid)}function j(){var c=/qq.com|taobao|tmall|mogujie.com|meilishuo.com|chaoji99.com|jd.com|yhd.com|1mall.com|dangdang.com|suning.com|vjia.com|vancl.com|taotaosou.com|360.cn|douban.com|weibo.com|vip.com|gome.com.cn|amazon.cn|jiuxian.com|jumei.com|zhe800.com|nuomi.com|paipai.com|meituan.com|yixun.com/;if(r.match(c))try{b(),a.__tk__seajs.config({map:[[/init.js/,function(a){return a+=-1===a.indexOf("?")?"?":"&",a+="t=10131536"}]]}),a.__tk__seajs.use("init")}catch(d){g("//log.taotaosou.com/browser_statistics.do?type=center_err")}}function k(){var a="user.qzone.qq.com";r===a&&(d().id.match(/B611040020150619/)||c("//ext.taotaosou.com/browser-static/qzone/qzone.js?t=10131536"))}function l(){s.match(/hzwuzhou|chaoji99|etao|alipay|zhifubao|alimama|alibaba|360safe.com|ie.sogou.com|liebao.cn|maxthon.cn|chrome.google.com\/webstore/)||d().id.match(/B611040020150619/)||c("//ext.taotaosou.com/js/tts_union_center.js?suid=10003028&v=10131536")}function m(){var a=("https:"===document.location.protocol?"https://":"http://")+"hm.baidu.com/h.js?";c(a+"f5127c6793d40d199f68042b8a63e725")}function n(b){var c=function(b){"complete"===document.readyState?b():document.addEventListener?(document.addEventListener("DOMContentLoaded",b,!1),a.addEventListener("load",b,!1)):document.attachEvent("onreadystatechange",b)};return b?void(q.match(/MSIE/)?c(function(){b()}):b()):!1}function o(a,b){var c=b||{};for(var d in a)"object"==typeof a[d]?(c[d]=a[d].constructor===Array?[]:{},o(a[d],c[d])):c[d]=a[d];return c}var p=function(){return a.self!==top?!0:!1};if("undefined"!=typeof a.TTSBrowserPlugin||p())return!1;a.TTSBrowserPlugin=!0;var q=a.navigator.userAgent,r=a.document.location.host,s=a.document.location.href,t=document.getElementById("J---TK-load"),u=f();a.jiayuId=u;var v="",w=document.cookie;w.match(/tracknick/)&&(v=w.replace(/.*tracknick=/,"").replace(/;.*/,""));var x=function(){return"item.taobao.com"!==r&&"detail.tmall.com"!==r||!document.getElementById("LineZing")?"":document.getElementById("LineZing").getAttribute("shopid")}(),y="//dclog.taotaosou.com/statistics.do?systemName=ttk_all&host="+(r||"")+"&ditch="+(d().id||"")+"&browser="+(d().browser||"")+"&url=1&ref="+(a.encodeURIComponent(a.document.referrer)||"")+"&sid="+a.jiayuId+"&z1_guid="+d().guid+"&z2_nick="+a.encodeURIComponent(v)+"&z3_shopid="+x;g(y),n(function(){c("//ext.taotaosou.com/js/config.js",function(){var b={media:{def:!0},taobao:{def:!0,model:{list:!0,detail:!0,lds:!0}},tmt:{def:!0,model:{shopSite:!0,paopao:!0,insert:!0,href:!0,qzone:!0,cps:!0}}};a.TK_config&&(b=o(a.TK_config,b)),i(),h(),b.taobao.def&&j();var c=["taobao","tmall","jd","vip","mogujie","meilishuo"];if(b.tmt.def)if(b.tmt.model.qzone&&k(),b.tmt.model.shopSite){for(var d=0;d=0){l();break}}else l()})}),m()}(window);
--------------------------------------------------------------------------------
/static/show.js:
--------------------------------------------------------------------------------
1 | $(document).ready(function () {
2 | $('.i-checks').iCheck({
3 | checkboxClass: 'icheckbox_square-green',
4 | radioClass: 'iradio_square-green',
5 | });
6 | });
7 |
8 | $(document).ready(function(){
9 |
10 | $('#loading-example-btn').click(function () {
11 | btn = $(this);
12 | simpleLoad(btn, true);
13 |
14 | simpleLoad(btn, false);
15 | });
16 | });
17 |
18 | function simpleLoad(btn, state) {
19 | if (state) {
20 | btn.children().addClass('fa-spin');
21 | btn.contents().last().replaceWith(" Loading");
22 | } else {
23 | setTimeout(function () {
24 | btn.children().removeClass('fa-spin');
25 | btn.contents().last().replaceWith(" Refresh");
26 | }, 2000);
27 | }
28 | }
29 |
30 | var config = {
31 | '.chosen-select' : {},
32 | '.chosen-select-deselect' : {allow_single_deselect:true},
33 | '.chosen-select-no-single' : {disable_search_threshold:10},
34 | '.chosen-select-no-results': {no_results_text:'Oops, nothing found!'},
35 | '.chosen-select-width' : {width:"95%"}
36 | };
37 | for (var selector in config) {
38 | $(selector).chosen(config[selector]);
39 | }
40 |
41 |
42 | function changeColorOver(node){
43 | node.style.color="white";
44 | // alert(node.style.color);
45 | }
46 |
47 | function changeColorOut(node){
48 | node.style.color="grey";
49 | // alert(node.style.color);
50 | }
51 |
52 | $("#rules_name").bind('input propertychange',function () {
53 | var content = $("#rules_name").val();
54 | var html = "- name: " + content + '_rules';
55 | $("#name_rules").html(html);
56 | var alerthtml = " - alert: " + content;
57 | $("#alert_rules").html(alerthtml);
58 | });
59 |
60 |
61 | $("#rules_expr").bind('input propertychange',function () {
62 | var content = $("#rules_expr").val();
63 | var html = " expr: " + content;
64 | $("#expr_rules").html(html);
65 | });
66 |
67 |
68 | $("#rules_time").bind('input propertychange',function () {
69 | var content = $("#rules_time").val();
70 | var html = " for: " + content;
71 | $("#time_rules").html(html);
72 | });
73 |
74 | $("#rules_desc").bind('input propertychange',function () {
75 | var content = $("#rules_desc").val();
76 | var html = " description: " + content;
77 | $("#desc_rules").html(html);
78 | });
79 |
80 |
81 | $("#rules_select").change(function(){
82 | var content=$("#rules_select").val();
83 | content = " level: " + content;
84 | $("#select_rules").html(content);
85 | });
86 |
87 |
88 | $("#service_select").bind('input propertychange',function () {
89 | var content = $("#service_select").val();
90 | var html = " service: " + content;
91 | $("#select_services").html(html);
92 | });
93 |
94 | //$("#service_select").change(function(){
95 | // var content=$("#service_select").val();
96 | // content = " service: " + content;
97 | // $("#select_services").html(content);
98 | //});
99 |
100 |
101 | $("#rules_select_item").change(function(){
102 | var content=$("#rules_select_item").val();
103 | content = $("#rules_expr").val() + content;
104 | $("#rules_expr").val(content);
105 | });
106 |
107 |
108 | function submit(){
109 | var name = $("#rules_name").val().trim();
110 | var expr = $("#rules_expr").val().trim();
111 | var _for = $("#rules_time").val().trim();
112 | var level = $("#rules_select").val().trim();
113 | var desc = $("#rules_desc").val().trim();
114 | var model = $("#rules_model").val().trim();
115 | var server = $("#service_select").val().trim();
116 |
117 | if(name == "" || expr == "" || _for == "" || level == "" || desc == "" || server ==""){
118 | alert("参数不能为空,请补全参数");
119 | return;
120 | }
121 | //alert(name + ' ' + expr + ' ' + _for + ' ' + level + ' ' + desc + ' ' + model);
122 |
123 | jQuery.ajax({
124 | type: "POST",
125 | url: "/prometheus/add",
126 | dataType: 'json',
127 | data : {
128 | "name": name,
129 | "expr": expr,
130 | "_for": _for,
131 | "level": level,
132 | "desc": desc,
133 | "model": model,
134 | "service": server
135 | },
136 | async: false,
137 | error: function () {
138 | alert("操作失败,请稍等片刻重新尝试,如仍有问题请联系管理员......");
139 | return false;
140 | },
141 | success : function(result){
142 | alert(result);
143 | }
144 | })
145 | }
146 |
147 | function refreshRule(){
148 |
149 | var x = confirm("是否确认刷新");
150 | if(x ==false){
151 | return;
152 | }
153 | jQuery.ajax({
154 | type: "POST",
155 | url: "/prometheus/refresh",
156 | async: false,
157 | error: function () {
158 | alert("操作失败,请稍等片刻重新尝试,如仍有问题请联系管理员......");
159 | return false;
160 | },
161 | success : function(result){
162 | alert(result);
163 | }
164 | })
165 | }
--------------------------------------------------------------------------------
/static/js/plugins/dataTables/dataTables.bootstrap.js:
--------------------------------------------------------------------------------
1 | /*! DataTables Bootstrap 3 integration
2 | * ©2011-2014 SpryMedia Ltd - datatables.net/license
3 | */
4 |
5 | /**
6 | * DataTables integration for Bootstrap 3. This requires Bootstrap 3 and
7 | * DataTables 1.10 or newer.
8 | *
9 | * This file sets the defaults and adds options to DataTables to style its
10 | * controls using Bootstrap. See http://datatables.net/manual/styling/bootstrap
11 | * for further information.
12 | */
13 | (function(window, document, undefined){
14 |
15 | var factory = function( $, DataTable ) {
16 | "use strict";
17 |
18 |
19 | /* Set the defaults for DataTables initialisation */
20 | $.extend( true, DataTable.defaults, {
21 | dom:
22 | "<'row'<'col-sm-6'l><'col-sm-6'f>>" +
23 | "<'row'<'col-sm-12'tr>>" +
24 | "<'row'<'col-sm-5'i><'col-sm-7'p>>",
25 | renderer: 'bootstrap'
26 | } );
27 |
28 |
29 | /* Default class modification */
30 | $.extend( DataTable.ext.classes, {
31 | sWrapper: "dataTables_wrapper form-inline dt-bootstrap",
32 | sFilterInput: "form-control input-sm",
33 | sLengthSelect: "form-control input-sm"
34 | } );
35 |
36 |
37 | /* Bootstrap paging button renderer */
38 | DataTable.ext.renderer.pageButton.bootstrap = function ( settings, host, idx, buttons, page, pages ) {
39 | var api = new DataTable.Api( settings );
40 | var classes = settings.oClasses;
41 | var lang = settings.oLanguage.oPaginate;
42 | var btnDisplay, btnClass, counter=0;
43 |
44 | var attach = function( container, buttons ) {
45 | var i, ien, node, button;
46 | var clickHandler = function ( e ) {
47 | e.preventDefault();
48 | if ( !$(e.currentTarget).hasClass('disabled') ) {
49 | api.page( e.data.action ).draw( 'page' );
50 | }
51 | };
52 |
53 | for ( i=0, ien=buttons.length ; i 0 ?
72 | '' : ' disabled');
73 | break;
74 |
75 | case 'previous':
76 | btnDisplay = lang.sPrevious;
77 | btnClass = button + (page > 0 ?
78 | '' : ' disabled');
79 | break;
80 |
81 | case 'next':
82 | btnDisplay = lang.sNext;
83 | btnClass = button + (page < pages-1 ?
84 | '' : ' disabled');
85 | break;
86 |
87 | case 'last':
88 | btnDisplay = lang.sLast;
89 | btnClass = button + (page < pages-1 ?
90 | '' : ' disabled');
91 | break;
92 |
93 | default:
94 | btnDisplay = button + 1;
95 | btnClass = page === button ?
96 | 'active' : '';
97 | break;
98 | }
99 |
100 | if ( btnDisplay ) {
101 | node = $('', {
102 | 'class': classes.sPageButton+' '+btnClass,
103 | 'id': idx === 0 && typeof button === 'string' ?
104 | settings.sTableId +'_'+ button :
105 | null
106 | } )
107 | .append( $('', {
108 | 'href': '#',
109 | 'aria-controls': settings.sTableId,
110 | 'data-dt-idx': counter,
111 | 'tabindex': settings.iTabIndex
112 | } )
113 | .html( btnDisplay )
114 | )
115 | .appendTo( container );
116 |
117 | settings.oApi._fnBindAction(
118 | node, {action: button}, clickHandler
119 | );
120 |
121 | counter++;
122 | }
123 | }
124 | }
125 | };
126 |
127 | // IE9 throws an 'unknown error' if document.activeElement is used
128 | // inside an iframe or frame.
129 | var activeEl;
130 |
131 | try {
132 | // Because this approach is destroying and recreating the paging
133 | // elements, focus is lost on the select button which is bad for
134 | // accessibility. So we want to restore focus once the draw has
135 | // completed
136 | activeEl = $(host).find(document.activeElement).data('dt-idx');
137 | }
138 | catch (e) {}
139 |
140 | attach(
141 | $(host).empty().html('').children('ul'),
142 | buttons
143 | );
144 |
145 | if ( activeEl ) {
146 | $(host).find( '[data-dt-idx='+activeEl+']' ).focus();
147 | }
148 | };
149 |
150 |
151 | /*
152 | * TableTools Bootstrap compatibility
153 | * Required TableTools 2.1+
154 | */
155 | if ( DataTable.TableTools ) {
156 | // Set the classes that TableTools uses to something suitable for Bootstrap
157 | $.extend( true, DataTable.TableTools.classes, {
158 | "container": "DTTT btn-group",
159 | "buttons": {
160 | "normal": "btn btn-default",
161 | "disabled": "disabled"
162 | },
163 | "collection": {
164 | "container": "DTTT_dropdown dropdown-menu",
165 | "buttons": {
166 | "normal": "",
167 | "disabled": "disabled"
168 | }
169 | },
170 | "print": {
171 | "info": "DTTT_print_info"
172 | },
173 | "select": {
174 | "row": "active"
175 | }
176 | } );
177 |
178 | // Have the collection use a bootstrap compatible drop down
179 | $.extend( true, DataTable.TableTools.DEFAULTS.oTags, {
180 | "collection": {
181 | "container": "ul",
182 | "button": "li",
183 | "liner": "a"
184 | }
185 | } );
186 | }
187 |
188 | }; // /factory
189 |
190 |
191 | // Define as an AMD module if possible
192 | if ( typeof define === 'function' && define.amd ) {
193 | define( ['jquery', 'datatables'], factory );
194 | }
195 | else if ( typeof exports === 'object' ) {
196 | // Node/CommonJS
197 | factory( require('jquery'), require('datatables') );
198 | }
199 | else if ( jQuery ) {
200 | // Otherwise simply initialise as normal, stopping multiple evaluation
201 | factory( jQuery, jQuery.fn.dataTable );
202 | }
203 |
204 |
205 | })(window, document);
206 |
207 |
--------------------------------------------------------------------------------
/static/selectCss.css:
--------------------------------------------------------------------------------
1 | /*!
2 | Chosen, a Select Box Enhancer for jQuery and Prototype
3 | by Patrick Filler for Harvest, http://getharvest.com
4 |
5 | Version 1.1.0
6 | Full source at https://github.com/harvesthq/chosen
7 | Copyright (c) 2011 Harvest http://getharvest.com
8 |
9 | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
10 | This file is generated by `grunt build`, do not edit it by hand.
11 | */
12 |
13 |
14 |
15 |
16 | /* @group Base */
17 | .chosen-container {
18 | position: relative;
19 | display: inline-block;
20 | vertical-align: middle;
21 | font-size: 15px;
22 | zoom: 1;
23 | /**display: inline;*/
24 | -webkit-user-select: none;
25 | -moz-user-select: none;
26 | user-select: none;
27 | }
28 | .chosen-container .chosen-drop {
29 | position: absolute;
30 | top: 100%;
31 | left: -9999px;
32 | z-index: 1010;
33 | -webkit-box-sizing: border-box;
34 | -moz-box-sizing: border-box;
35 | box-sizing: border-box;
36 | width: 100%;
37 | border: 1px solid #aaa;
38 | border-top: 0;
39 | background: #fff;
40 | box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15);
41 | }
42 |
43 | .chosen-container.chosen-with-drop .chosen-drop {
44 | left: 0;
45 | }
46 | .chosen-container a {
47 | cursor: pointer;
48 | }
49 |
50 | /* @end */
51 | /* @group Single Chosen */
52 | .chosen-container-single .chosen-single {
53 | position: relative;
54 | display: block;
55 | overflow: hidden;
56 | /*position: absolute;*/
57 | top: 0;
58 | left: 7px;
59 | /*width: 100%;*/
60 | padding: 0 0 0 8px;
61 | height: 30px;
62 | border: 1px solid #aaa;
63 | /*border-radius: 5px;*/
64 | background-color: #fff;
65 | /*background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #ffffff), color-stop(50%, #f6f6f6), color-stop(52%, #eeeeee), color-stop(100%, #f4f4f4));*/
66 | /*background: -webkit-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);*/
67 | /*background: -moz-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);*/
68 | /*background: -o-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);*/
69 | /*background: linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);*/
70 | background-clip: padding-box;
71 | box-shadow: 0 0 3px white inset, 0 1px 1px rgba(0, 0, 0, 0.1);
72 | color: grey;
73 | text-decoration: none;
74 | white-space: nowrap;
75 | line-height: 30px;
76 | }
77 | .chosen-container-single .chosen-default {
78 | color: #999;
79 | }
80 | .chosen-container-single .chosen-single span {
81 | display: block;
82 | overflow: hidden;
83 | margin-right: 26px;
84 | text-overflow: ellipsis;
85 | white-space: nowrap;
86 | }
87 | .chosen-container-single .chosen-single-with-deselect span {
88 | margin-right: 38px;
89 | }
90 |
91 | .chosen-container-single .chosen-single abbr:hover {
92 | background-position: -42px -10px;
93 | }
94 | .chosen-container-single.chosen-disabled .chosen-single abbr:hover {
95 | background-position: -42px -10px;
96 | }
97 |
98 | .chosen-container-single .chosen-search input[type="text"] {
99 | -webkit-box-sizing: border-box;
100 | -moz-box-sizing: border-box;
101 | box-sizing: border-box;
102 | margin: 1px 0;
103 | padding: 4px 20px 4px 5px;
104 | width: 100%;
105 | height: auto;
106 | outline: 0;
107 | border: 1px solid #aaa;
108 | /*background: white url('chosen-sprite.png') no-repeat 100% -20px;*/
109 | /*background: url('chosen-sprite.png') no-repeat 100% -20px;*/
110 | font-size: 1em;
111 | font-family: sans-serif;
112 | line-height: normal;
113 | border-radius: 0;
114 | }
115 | .chosen-container-single .chosen-drop {
116 | /*position: absolute;*/
117 | /*left: 6px;*/
118 | /*margin-top: 0;*/
119 | margin: 0 0 0 7px ;
120 | border-radius: 0 0 4px 4px;
121 | background-clip: padding-box;
122 | }
123 | .chosen-container-single.chosen-container-single-nosearch .chosen-search {
124 | position: absolute;
125 | left: -9999px;
126 | }
127 |
128 | /* @end */
129 | /* @group Results */
130 | .chosen-container .chosen-results {
131 | position: relative;
132 | overflow-x: hidden;
133 | overflow-y: auto;
134 | margin: 0 4px 4px 0;
135 | padding: 0 0 0 4px;
136 | max-height: 240px;
137 | -webkit-overflow-scrolling: touch;
138 | }
139 | .chosen-container .chosen-results li {
140 | display: none;
141 | margin: 0;
142 | padding: 5px 6px;
143 | list-style: none;
144 | line-height: 15px;
145 | -webkit-touch-callout: none;
146 | }
147 | .chosen-container .chosen-results li.active-result {
148 | display: list-item;
149 | cursor: pointer;
150 | }
151 | .chosen-container .chosen-results li.disabled-result {
152 | display: list-item;
153 | color: #ccc;
154 | cursor: default;
155 | }
156 | .chosen-container .chosen-results li.highlighted {
157 | background-color: #3875d7;
158 | background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #3875d7), color-stop(90%, #2a62bc));
159 | background-image: -webkit-linear-gradient(#3875d7 20%, #2a62bc 90%);
160 | background-image: -moz-linear-gradient(#3875d7 20%, #2a62bc 90%);
161 | background-image: -o-linear-gradient(#3875d7 20%, #2a62bc 90%);
162 | background-image: linear-gradient(#3875d7 20%, #2a62bc 90%);
163 | color: #fff;
164 | }
165 | .chosen-container .chosen-results li.no-results {
166 | display: list-item;
167 | background: #f4f4f4;
168 | }
169 | .chosen-container .chosen-results li.group-result {
170 | display: list-item;
171 | font-weight: bold;
172 | cursor: default;
173 | }
174 | .chosen-container .chosen-results li.group-option {
175 | padding-left: 15px;
176 | }
177 | .chosen-container .chosen-results li em {
178 | font-style: normal;
179 | text-decoration: underline;
180 | }
181 |
182 |
--------------------------------------------------------------------------------
/static/skin-config_files/sea.js:
--------------------------------------------------------------------------------
1 | /*! seajs 2.0.0 | seajs.org/LICENSE.md | define change __tk2__define | seajs change __tk2__seajs */
2 | (function(u,r){function x(a){return function(c){return Object.prototype.toString.call(c)==="[object "+a+"]"}}function H(a){return a.match(ha)[0]}function O(a){a=a.replace(ia,"/");for(a=a.replace(ja,"$1/");a.match(P);)a=a.replace(P,"/");return a}function Q(a){a=O(a);ka.test(a)?a=a.slice(0,-1):la.test(a)||(a+=".js");return a.replace(":80/","/")}function ma(a){var c=h.vars;c&&-1 ")),p.length=0,c(!0)):(aa[a]=e,W(e,c))}function d(a){!a&&f.status=da)return a.exports;a.status=da;b.resolve=c;b.async=function(a,d){D(c(a),d);return b};var d=a.factory,d=y(d)?d(b,a.exports={},a):d;a.exports=d===r?a.exports:d;
9 | a.status=Da;return a.exports}function Y(a){for(var c=[],b=0;b1*navigator.userAgent.replace(/.*AppleWebKit\/(\d+)\..*/,
13 | "$1"),za=/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\/\*[\S\s]*?\*\/|\/(?:\\\/|[^/\r\n])+\/(?=[^\/])|\/\/.*|\.\s*require|(?:^|[^$])\brequire\s*\(\s*(["'])(.+?)\1\s*\)/g,ya=/\\\\/g,k=f.cache={},F,L={},M={},G={},aa={},Aa=1,E=2,K=3,da=4,Da=5;B.prototype.destroy=function(){delete k[this.uri];delete M[this.uri]};var p=[];f.use=function(a,c){ea(function(){D(s(a),c)});return f};B.load=D;f.resolve=J;u.__tk2__define=Ba;f.require=function(a){return(k[J(a)]||{}).exports};var h=N.data={base:function(){var a=fa,c=a.match(/^(.+?\/)(?:__tk2__seajs\/)+(?:\d[^/]+\/)?$/);
14 | c&&(a=c[1]);return a}(),charset:"utf-8",preload:[]};f.config=N;N({plugins:function(){var a,c=ga.search.replace(/(__tk2__seajs-\w+)(&|$)/g,"$1=1$2"),c=c+(" "+m.cookie);c.replace(/__tk2__seajs-(\w+)=1/g,function(b,c){(a||(a=[])).push(c)});return a}()});q=g.getAttribute("data-config");g=g.getAttribute("data-main");q&&h.preload.push(q);g&&f.use(g);if(l&&l.args)for(q=["define","config","use"],l=l.args,g=0;g';
53 | }else{
54 | html = html + '';
55 | html = html + ''+index+'';
56 | html = html + '';
57 | }
58 | index = index +1;
59 | }
60 | //html = html + '';
61 | //html = html + ''+pageNow+'';
62 | //html = html + '';
63 |
64 | index = pageNow+1;
65 |
66 | while(index < pageNow+4 && index <= totlepage-1){
67 | html = html + '';
68 | html = html + ''+index+'';
69 | html = html + '';
70 | index = index +1;
71 | }
72 |
73 | if(totlepage > pageNow + 3){
74 | html = html + '';
75 | html = html + '...';
76 | html = html + '';
77 | }
78 |
79 | if(pageNow == totlepage){
80 | html = html + '';
81 | html = html + ''+totlepage+'';
82 | html = html + '';
83 | }else{
84 | html = html + '';
85 | html = html + ''+totlepage+'';
86 | html = html + '';
87 | }
88 |
89 | // 下一页
90 | if(pageNow*size >= totle || pageNow == totlepage){
91 | html = html + '';
92 | html = html + 'Next';
93 |
94 | }else{
95 | html = html + '';
96 | s = pageNow+1;
97 | html = html + 'Next';
98 | }
99 | html = html + '';
100 |
101 | // 行级选择
102 | // html = html + '';
103 | // html = html + '';
122 | // html = html + '';
123 | // html = html + '';
124 | // html = html + '';
125 |
126 | $("#"+id).html(html);
127 | }
--------------------------------------------------------------------------------
/static/js/plugins/flot/jquery.flot.spline.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Flot plugin that provides spline interpolation for line graphs
3 | * author: Alex Bardas < alex.bardas@gmail.com >
4 | * modified by: Avi Kohn https://github.com/AMKohn
5 | * based on the spline interpolation described at:
6 | * http://scaledinnovation.com/analytics/splines/aboutSplines.html
7 | *
8 | * Example usage: (add in plot options series object)
9 | * for linespline:
10 | * series: {
11 | * ...
12 | * lines: {
13 | * show: false
14 | * },
15 | * splines: {
16 | * show: true,
17 | * tension: x, (float between 0 and 1, defaults to 0.5),
18 | * lineWidth: y (number, defaults to 2),
19 | * fill: z (float between 0 .. 1 or false, as in flot documentation)
20 | * },
21 | * ...
22 | * }
23 | * areaspline:
24 | * series: {
25 | * ...
26 | * lines: {
27 | * show: true,
28 | * lineWidth: 0, (line drawing will not execute)
29 | * fill: x, (float between 0 .. 1, as in flot documentation)
30 | * ...
31 | * },
32 | * splines: {
33 | * show: true,
34 | * tension: 0.5 (float between 0 and 1)
35 | * },
36 | * ...
37 | * }
38 | *
39 | */
40 |
41 | (function($) {
42 | 'use strict'
43 |
44 | /**
45 | * @param {Number} x0, y0, x1, y1: coordinates of the end (knot) points of the segment
46 | * @param {Number} x2, y2: the next knot (not connected, but needed to calculate p2)
47 | * @param {Number} tension: control how far the control points spread
48 | * @return {Array}: p1 -> control point, from x1 back toward x0
49 | * p2 -> the next control point, returned to become the next segment's p1
50 | *
51 | * @api private
52 | */
53 | function getControlPoints(x0, y0, x1, y1, x2, y2, tension) {
54 |
55 | var pow = Math.pow,
56 | sqrt = Math.sqrt,
57 | d01, d12, fa, fb, p1x, p1y, p2x, p2y;
58 |
59 | // Scaling factors: distances from this knot to the previous and following knots.
60 | d01 = sqrt(pow(x1 - x0, 2) + pow(y1 - y0, 2));
61 | d12 = sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2));
62 |
63 | fa = tension * d01 / (d01 + d12);
64 | fb = tension - fa;
65 |
66 | p1x = x1 + fa * (x0 - x2);
67 | p1y = y1 + fa * (y0 - y2);
68 |
69 | p2x = x1 - fb * (x0 - x2);
70 | p2y = y1 - fb * (y0 - y2);
71 |
72 | return [p1x, p1y, p2x, p2y];
73 | }
74 |
75 | var line = [];
76 |
77 | function drawLine(points, ctx, height, fill, seriesColor) {
78 | var c = $.color.parse(seriesColor);
79 |
80 | c.a = typeof fill == "number" ? fill : .3;
81 | c.normalize();
82 | c = c.toString();
83 |
84 | ctx.beginPath();
85 | ctx.moveTo(points[0][0], points[0][1]);
86 |
87 | var plength = points.length;
88 |
89 | for (var i = 0; i < plength; i++) {
90 | ctx[points[i][3]].apply(ctx, points[i][2]);
91 | }
92 |
93 | ctx.stroke();
94 |
95 | ctx.lineWidth = 0;
96 | ctx.lineTo(points[plength - 1][0], height);
97 | ctx.lineTo(points[0][0], height);
98 |
99 | ctx.closePath();
100 |
101 | if (fill !== false) {
102 | ctx.fillStyle = c;
103 | ctx.fill();
104 | }
105 | }
106 |
107 | /**
108 | * @param {Object} ctx: canvas context
109 | * @param {String} type: accepted strings: 'bezier' or 'quadratic' (defaults to quadratic)
110 | * @param {Array} points: 2 points for which to draw the interpolation
111 | * @param {Array} cpoints: control points for those segment points
112 | *
113 | * @api private
114 | */
115 | function queue(ctx, type, points, cpoints) {
116 | if (type === void 0 || (type !== 'bezier' && type !== 'quadratic')) {
117 | type = 'quadratic';
118 | }
119 | type = type + 'CurveTo';
120 |
121 | if (line.length == 0) line.push([points[0], points[1], cpoints.concat(points.slice(2)), type]);
122 | else if (type == "quadraticCurveTo" && points.length == 2) {
123 | cpoints = cpoints.slice(0, 2).concat(points);
124 |
125 | line.push([points[0], points[1], cpoints, type]);
126 | }
127 | else line.push([points[2], points[3], cpoints.concat(points.slice(2)), type]);
128 | }
129 |
130 | /**
131 | * @param {Object} plot
132 | * @param {Object} ctx: canvas context
133 | * @param {Object} series
134 | *
135 | * @api private
136 | */
137 |
138 | function drawSpline(plot, ctx, series) {
139 | // Not interested if spline is not requested
140 | if (series.splines.show !== true) {
141 | return;
142 | }
143 |
144 | var cp = [],
145 | // array of control points
146 | tension = series.splines.tension || 0.5,
147 | idx, x, y, points = series.datapoints.points,
148 | ps = series.datapoints.pointsize,
149 | plotOffset = plot.getPlotOffset(),
150 | len = points.length,
151 | pts = [];
152 |
153 | line = [];
154 |
155 | // Cannot display a linespline/areaspline if there are less than 3 points
156 | if (len / ps < 4) {
157 | $.extend(series.lines, series.splines);
158 | return;
159 | }
160 |
161 | for (idx = 0; idx < len; idx += ps) {
162 | x = points[idx];
163 | y = points[idx + 1];
164 | if (x == null || x < series.xaxis.min || x > series.xaxis.max || y < series.yaxis.min || y > series.yaxis.max) {
165 | continue;
166 | }
167 |
168 | pts.push(series.xaxis.p2c(x) + plotOffset.left, series.yaxis.p2c(y) + plotOffset.top);
169 | }
170 |
171 | len = pts.length;
172 |
173 | // Draw an open curve, not connected at the ends
174 | for (idx = 0; idx < len - 2; idx += 2) {
175 | cp = cp.concat(getControlPoints.apply(this, pts.slice(idx, idx + 6).concat([tension])));
176 | }
177 |
178 | ctx.save();
179 | ctx.strokeStyle = series.color;
180 | ctx.lineWidth = series.splines.lineWidth;
181 |
182 | queue(ctx, 'quadratic', pts.slice(0, 4), cp.slice(0, 2));
183 |
184 | for (idx = 2; idx < len - 3; idx += 2) {
185 | queue(ctx, 'bezier', pts.slice(idx, idx + 4), cp.slice(2 * idx - 2, 2 * idx + 2));
186 | }
187 |
188 | queue(ctx, 'quadratic', pts.slice(len - 2, len), [cp[2 * len - 10], cp[2 * len - 9], pts[len - 4], pts[len - 3]]);
189 |
190 | drawLine(line, ctx, plot.height() + 10, series.splines.fill, series.color);
191 |
192 | ctx.restore();
193 | }
194 |
195 | $.plot.plugins.push({
196 | init: function(plot) {
197 | plot.hooks.drawSeries.push(drawSpline);
198 | },
199 | options: {
200 | series: {
201 | splines: {
202 | show: false,
203 | lineWidth: 2,
204 | tension: 0.5,
205 | fill: false
206 | }
207 | }
208 | },
209 | name: 'spline',
210 | version: '0.8.2'
211 | });
212 | })(jQuery);
213 |
--------------------------------------------------------------------------------
/static/js/plugins/jqGrid/i18n/grid.locale-en.js:
--------------------------------------------------------------------------------
1 | ;(function($){
2 | /**
3 | * jqGrid English Translation
4 | * Tony Tomov tony@trirand.com
5 | * http://trirand.com/blog/
6 | * Dual licensed under the MIT and GPL licenses:
7 | * http://www.opensource.org/licenses/mit-license.php
8 | * http://www.gnu.org/licenses/gpl.html
9 | **/
10 | $.jgrid = $.jgrid || {};
11 | $.extend($.jgrid,{
12 | defaults : {
13 | recordtext: "View {0} - {1} of {2}",
14 | emptyrecords: "No records to view",
15 | loadtext: "Loading...",
16 | pgtext : "Page {0} of {1}"
17 | },
18 | search : {
19 | caption: "Search...",
20 | Find: "Find",
21 | Reset: "Reset",
22 | odata: [{ oper:'eq', text:'equal'},{ oper:'ne', text:'not equal'},{ oper:'lt', text:'less'},{ oper:'le', text:'less or equal'},{ oper:'gt', text:'greater'},{ oper:'ge', text:'greater or equal'},{ oper:'bw', text:'begins with'},{ oper:'bn', text:'does not begin with'},{ oper:'in', text:'is in'},{ oper:'ni', text:'is not in'},{ oper:'ew', text:'ends with'},{ oper:'en', text:'does not end with'},{ oper:'cn', text:'contains'},{ oper:'nc', text:'does not contain'},{ oper:'nu', text:'is null'},{ oper:'nn', text:'is not null'}],
23 | groupOps: [{ op: "AND", text: "all" },{ op: "OR", text: "any" }],
24 | operandTitle : "Click to select search operation.",
25 | resetTitle : "Reset Search Value"
26 | },
27 | edit : {
28 | addCaption: "Add Record",
29 | editCaption: "Edit Record",
30 | bSubmit: "Submit",
31 | bCancel: "Cancel",
32 | bClose: "Close",
33 | saveData: "Data has been changed! Save changes?",
34 | bYes : "Yes",
35 | bNo : "No",
36 | bExit : "Cancel",
37 | msg: {
38 | required:"Field is required",
39 | number:"Please, enter valid number",
40 | minValue:"value must be greater than or equal to ",
41 | maxValue:"value must be less than or equal to",
42 | email: "is not a valid e-mail",
43 | integer: "Please, enter valid integer value",
44 | date: "Please, enter valid date value",
45 | url: "is not a valid URL. Prefix required ('http://' or 'https://')",
46 | nodefined : " is not defined!",
47 | novalue : " return value is required!",
48 | customarray : "Custom function should return array!",
49 | customfcheck : "Custom function should be present in case of custom checking!"
50 |
51 | }
52 | },
53 | view : {
54 | caption: "View Record",
55 | bClose: "Close"
56 | },
57 | del : {
58 | caption: "Delete",
59 | msg: "Delete selected record(s)?",
60 | bSubmit: "Delete",
61 | bCancel: "Cancel"
62 | },
63 | nav : {
64 | edittext: "",
65 | edittitle: "Edit selected row",
66 | addtext:"",
67 | addtitle: "Add new row",
68 | deltext: "",
69 | deltitle: "Delete selected row",
70 | searchtext: "",
71 | searchtitle: "Find records",
72 | refreshtext: "",
73 | refreshtitle: "Reload Grid",
74 | alertcap: "Warning",
75 | alerttext: "Please, select row",
76 | viewtext: "",
77 | viewtitle: "View selected row"
78 | },
79 | col : {
80 | caption: "Select columns",
81 | bSubmit: "Ok",
82 | bCancel: "Cancel"
83 | },
84 | errors : {
85 | errcap : "Error",
86 | nourl : "No url is set",
87 | norecords: "No records to process",
88 | model : "Length of colNames <> colModel!"
89 | },
90 | formatter : {
91 | integer : {thousandsSeparator: ",", defaultValue: '0'},
92 | number : {decimalSeparator:".", thousandsSeparator: ",", decimalPlaces: 2, defaultValue: '0.00'},
93 | currency : {decimalSeparator:".", thousandsSeparator: ",", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'},
94 | date : {
95 | dayNames: [
96 | "Sun", "Mon", "Tue", "Wed", "Thr", "Fri", "Sat",
97 | "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
98 | ],
99 | monthNames: [
100 | "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
101 | "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
102 | ],
103 | AmPm : ["am","pm","AM","PM"],
104 | S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th';},
105 | srcformat: 'Y-m-d',
106 | newformat: 'n/j/Y',
107 | parseRe : /[#%\\\/:_;.,\t\s-]/,
108 | masks : {
109 | // see http://php.net/manual/en/function.date.php for PHP format used in jqGrid
110 | // and see http://docs.jquery.com/UI/Datepicker/formatDate
111 | // and https://github.com/jquery/globalize#dates for alternative formats used frequently
112 | // one can find on https://github.com/jquery/globalize/tree/master/lib/cultures many
113 | // information about date, time, numbers and currency formats used in different countries
114 | // one should just convert the information in PHP format
115 | ISO8601Long:"Y-m-d H:i:s",
116 | ISO8601Short:"Y-m-d",
117 | // short date:
118 | // n - Numeric representation of a month, without leading zeros
119 | // j - Day of the month without leading zeros
120 | // Y - A full numeric representation of a year, 4 digits
121 | // example: 3/1/2012 which means 1 March 2012
122 | ShortDate: "n/j/Y", // in jQuery UI Datepicker: "M/d/yyyy"
123 | // long date:
124 | // l - A full textual representation of the day of the week
125 | // F - A full textual representation of a month
126 | // d - Day of the month, 2 digits with leading zeros
127 | // Y - A full numeric representation of a year, 4 digits
128 | LongDate: "l, F d, Y", // in jQuery UI Datepicker: "dddd, MMMM dd, yyyy"
129 | // long date with long time:
130 | // l - A full textual representation of the day of the week
131 | // F - A full textual representation of a month
132 | // d - Day of the month, 2 digits with leading zeros
133 | // Y - A full numeric representation of a year, 4 digits
134 | // g - 12-hour format of an hour without leading zeros
135 | // i - Minutes with leading zeros
136 | // s - Seconds, with leading zeros
137 | // A - Uppercase Ante meridiem and Post meridiem (AM or PM)
138 | FullDateTime: "l, F d, Y g:i:s A", // in jQuery UI Datepicker: "dddd, MMMM dd, yyyy h:mm:ss tt"
139 | // month day:
140 | // F - A full textual representation of a month
141 | // d - Day of the month, 2 digits with leading zeros
142 | MonthDay: "F d", // in jQuery UI Datepicker: "MMMM dd"
143 | // short time (without seconds)
144 | // g - 12-hour format of an hour without leading zeros
145 | // i - Minutes with leading zeros
146 | // A - Uppercase Ante meridiem and Post meridiem (AM or PM)
147 | ShortTime: "g:i A", // in jQuery UI Datepicker: "h:mm tt"
148 | // long time (with seconds)
149 | // g - 12-hour format of an hour without leading zeros
150 | // i - Minutes with leading zeros
151 | // s - Seconds, with leading zeros
152 | // A - Uppercase Ante meridiem and Post meridiem (AM or PM)
153 | LongTime: "g:i:s A", // in jQuery UI Datepicker: "h:mm:ss tt"
154 | SortableDateTime: "Y-m-d\\TH:i:s",
155 | UniversalSortableDateTime: "Y-m-d H:i:sO",
156 | // month with year
157 | // Y - A full numeric representation of a year, 4 digits
158 | // F - A full textual representation of a month
159 | YearMonth: "F, Y" // in jQuery UI Datepicker: "MMMM, yyyy"
160 | },
161 | reformatAfterEdit : false
162 | },
163 | baseLinkUrl: '',
164 | showAction: '',
165 | target: '',
166 | checkbox : {disabled:true},
167 | idName : 'id'
168 | }
169 | });
170 | })(jQuery);
171 |
--------------------------------------------------------------------------------
/static/js/demo/chartjs-demo.js:
--------------------------------------------------------------------------------
1 | $(function () {
2 |
3 | var lineData = {
4 | labels: ["January", "February", "March", "April", "May", "June", "July"],
5 | datasets: [
6 | {
7 | label: "Example dataset",
8 | fillColor: "rgba(220,220,220,0.5)",
9 | strokeColor: "rgba(220,220,220,1)",
10 | pointColor: "rgba(220,220,220,1)",
11 | pointStrokeColor: "#fff",
12 | pointHighlightFill: "#fff",
13 | pointHighlightStroke: "rgba(220,220,220,1)",
14 | data: [65, 59, 80, 81, 56, 55, 40]
15 | },
16 | {
17 | label: "Example dataset",
18 | fillColor: "rgba(26,179,148,0.5)",
19 | strokeColor: "rgba(26,179,148,0.7)",
20 | pointColor: "rgba(26,179,148,1)",
21 | pointStrokeColor: "#fff",
22 | pointHighlightFill: "#fff",
23 | pointHighlightStroke: "rgba(26,179,148,1)",
24 | data: [28, 48, 40, 19, 86, 27, 90]
25 | }
26 | ]
27 | };
28 |
29 | var lineOptions = {
30 | scaleShowGridLines: true,
31 | scaleGridLineColor: "rgba(0,0,0,.05)",
32 | scaleGridLineWidth: 1,
33 | bezierCurve: true,
34 | bezierCurveTension: 0.4,
35 | pointDot: true,
36 | pointDotRadius: 4,
37 | pointDotStrokeWidth: 1,
38 | pointHitDetectionRadius: 20,
39 | datasetStroke: true,
40 | datasetStrokeWidth: 2,
41 | datasetFill: true,
42 | responsive: true,
43 | };
44 |
45 |
46 | var ctx = document.getElementById("lineChart").getContext("2d");
47 | var myNewChart = new Chart(ctx).Line(lineData, lineOptions);
48 |
49 | var barData = {
50 | labels: ["January", "February", "March", "April", "May", "June", "July"],
51 | datasets: [
52 | {
53 | label: "My First dataset",
54 | fillColor: "rgba(220,220,220,0.5)",
55 | strokeColor: "rgba(220,220,220,0.8)",
56 | highlightFill: "rgba(220,220,220,0.75)",
57 | highlightStroke: "rgba(220,220,220,1)",
58 | data: [65, 59, 80, 81, 56, 55, 40]
59 | },
60 | {
61 | label: "My Second dataset",
62 | fillColor: "rgba(26,179,148,0.5)",
63 | strokeColor: "rgba(26,179,148,0.8)",
64 | highlightFill: "rgba(26,179,148,0.75)",
65 | highlightStroke: "rgba(26,179,148,1)",
66 | data: [28, 48, 40, 19, 86, 27, 90]
67 | }
68 | ]
69 | };
70 |
71 | var barOptions = {
72 | scaleBeginAtZero: true,
73 | scaleShowGridLines: true,
74 | scaleGridLineColor: "rgba(0,0,0,.05)",
75 | scaleGridLineWidth: 1,
76 | barShowStroke: true,
77 | barStrokeWidth: 2,
78 | barValueSpacing: 5,
79 | barDatasetSpacing: 1,
80 | responsive: true,
81 | }
82 |
83 |
84 | var ctx = document.getElementById("barChart").getContext("2d");
85 | var myNewChart = new Chart(ctx).Bar(barData, barOptions);
86 |
87 | var polarData = [
88 | {
89 | value: 300,
90 | color: "#a3e1d4",
91 | highlight: "#1ab394",
92 | label: "App"
93 | },
94 | {
95 | value: 140,
96 | color: "#dedede",
97 | highlight: "#1ab394",
98 | label: "Software"
99 | },
100 | {
101 | value: 200,
102 | color: "#b5b8cf",
103 | highlight: "#1ab394",
104 | label: "Laptop"
105 | }
106 | ];
107 |
108 | var polarOptions = {
109 | scaleShowLabelBackdrop: true,
110 | scaleBackdropColor: "rgba(255,255,255,0.75)",
111 | scaleBeginAtZero: true,
112 | scaleBackdropPaddingY: 1,
113 | scaleBackdropPaddingX: 1,
114 | scaleShowLine: true,
115 | segmentShowStroke: true,
116 | segmentStrokeColor: "#fff",
117 | segmentStrokeWidth: 2,
118 | animationSteps: 100,
119 | animationEasing: "easeOutBounce",
120 | animateRotate: true,
121 | animateScale: false,
122 | responsive: true,
123 |
124 | };
125 |
126 | var ctx = document.getElementById("polarChart").getContext("2d");
127 | var myNewChart = new Chart(ctx).PolarArea(polarData, polarOptions);
128 |
129 | var doughnutData = [
130 | {
131 | value: 300,
132 | color: "#a3e1d4",
133 | highlight: "#1ab394",
134 | label: "App"
135 | },
136 | {
137 | value: 50,
138 | color: "#dedede",
139 | highlight: "#1ab394",
140 | label: "Software"
141 | },
142 | {
143 | value: 100,
144 | color: "#b5b8cf",
145 | highlight: "#1ab394",
146 | label: "Laptop"
147 | }
148 | ];
149 |
150 | var doughnutOptions = {
151 | segmentShowStroke: true,
152 | segmentStrokeColor: "#fff",
153 | segmentStrokeWidth: 2,
154 | percentageInnerCutout: 45, // This is 0 for Pie charts
155 | animationSteps: 100,
156 | animationEasing: "easeOutBounce",
157 | animateRotate: true,
158 | animateScale: false,
159 | responsive: true,
160 | };
161 |
162 |
163 | var ctx = document.getElementById("doughnutChart").getContext("2d");
164 | var myNewChart = new Chart(ctx).Doughnut(doughnutData, doughnutOptions);
165 |
166 |
167 | var radarData = {
168 | labels: ["Eating", "Drinking", "Sleeping", "Designing", "Coding", "Cycling", "Running"],
169 | datasets: [
170 | {
171 | label: "My First dataset",
172 | fillColor: "rgba(220,220,220,0.2)",
173 | strokeColor: "rgba(220,220,220,1)",
174 | pointColor: "rgba(220,220,220,1)",
175 | pointStrokeColor: "#fff",
176 | pointHighlightFill: "#fff",
177 | pointHighlightStroke: "rgba(220,220,220,1)",
178 | data: [65, 59, 90, 81, 56, 55, 40]
179 | },
180 | {
181 | label: "My Second dataset",
182 | fillColor: "rgba(26,179,148,0.2)",
183 | strokeColor: "rgba(26,179,148,1)",
184 | pointColor: "rgba(26,179,148,1)",
185 | pointStrokeColor: "#fff",
186 | pointHighlightFill: "#fff",
187 | pointHighlightStroke: "rgba(151,187,205,1)",
188 | data: [28, 48, 40, 19, 96, 27, 100]
189 | }
190 | ]
191 | };
192 |
193 | var radarOptions = {
194 | scaleShowLine: true,
195 | angleShowLineOut: true,
196 | scaleShowLabels: false,
197 | scaleBeginAtZero: true,
198 | angleLineColor: "rgba(0,0,0,.1)",
199 | angleLineWidth: 1,
200 | pointLabelFontFamily: "'Arial'",
201 | pointLabelFontStyle: "normal",
202 | pointLabelFontSize: 10,
203 | pointLabelFontColor: "#666",
204 | pointDot: true,
205 | pointDotRadius: 3,
206 | pointDotStrokeWidth: 1,
207 | pointHitDetectionRadius: 20,
208 | datasetStroke: true,
209 | datasetStrokeWidth: 2,
210 | datasetFill: true,
211 | responsive: true,
212 | }
213 |
214 | var ctx = document.getElementById("radarChart").getContext("2d");
215 | var myNewChart = new Chart(ctx).Radar(radarData, radarOptions);
216 |
217 | });
--------------------------------------------------------------------------------
/static/pages/update.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | udpate rules
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
更新告警规则
17 |
18 |
19 |
20 |
21 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
77 |
78 |
79 |
80 |
81 |
82 |
告警规则预览:
83 |
groups:
84 |
- name:
85 |
rules:
86 |
- alert:
87 |
expr:
88 |
for:
89 |
labels:
90 |
level:
91 |
service:
92 |
annotations:
93 |
summary: "告警主机和端口{{ $labels.instance }} 告警值:{{ $value }}"
94 |
description:
95 |
96 |
97 |
98 |
99 |
100 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
--------------------------------------------------------------------------------
/static/js/inspinia.js:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * INSPINIA - Responsive Admin Theme
4 | * version 2.2
5 | *
6 | */
7 |
8 |
9 | $(document).ready(function () {
10 |
11 |
12 | // Add body-small class if window less than 768px
13 | if ($(this).width() < 769) {
14 | $('body').addClass('body-small')
15 | } else {
16 | $('body').removeClass('body-small')
17 | }
18 |
19 | // MetsiMenu
20 | $('#side-menu').metisMenu();
21 |
22 | // Collapse ibox function
23 | $('.collapse-link').click(function () {
24 | var ibox = $(this).closest('div.ibox');
25 | var button = $(this).find('i');
26 | var content = ibox.find('div.ibox-content');
27 | content.slideToggle(200);
28 | button.toggleClass('fa-chevron-up').toggleClass('fa-chevron-down');
29 | ibox.toggleClass('').toggleClass('border-bottom');
30 | setTimeout(function () {
31 | ibox.resize();
32 | ibox.find('[id^=map-]').resize();
33 | }, 50);
34 | });
35 |
36 | // Close ibox function
37 | $('.close-link').click(function () {
38 | var content = $(this).closest('div.ibox');
39 | content.remove();
40 | });
41 |
42 | // Fullscreen ibox function
43 | $('.fullscreen-link').click(function() {
44 | var ibox = $(this).closest('div.ibox');
45 | var button = $(this).find('i');
46 | $('body').toggleClass('fullscreen-ibox-mode');
47 | button.toggleClass('fa-expand').toggleClass('fa-compress');
48 | ibox.toggleClass('fullscreen');
49 | setTimeout(function() {
50 | $(window).trigger('resize');
51 | }, 100);
52 | });
53 |
54 | // Close menu in canvas mode
55 | $('.close-canvas-menu').click(function () {
56 | $("body").toggleClass("mini-navbar");
57 | SmoothlyMenu();
58 | });
59 |
60 | // Open close right sidebar
61 | $('.right-sidebar-toggle').click(function () {
62 | $('#right-sidebar').toggleClass('sidebar-open');
63 | });
64 |
65 | // Initialize slimscroll for right sidebar
66 | $('.sidebar-container').slimScroll({
67 | height: '100%',
68 | railOpacity: 0.4,
69 | wheelStep: 10
70 | });
71 |
72 | // Open close small chat
73 | $('.open-small-chat').click(function () {
74 | $(this).children().toggleClass('fa-comments').toggleClass('fa-remove');
75 | $('.small-chat-box').toggleClass('active');
76 | });
77 |
78 | // Initialize slimscroll for small chat
79 | $('.small-chat-box .content').slimScroll({
80 | height: '234px',
81 | railOpacity: 0.4
82 | });
83 |
84 | // Small todo handler
85 | $('.check-link').click(function () {
86 | var button = $(this).find('i');
87 | var label = $(this).next('span');
88 | button.toggleClass('fa-check-square').toggleClass('fa-square-o');
89 | label.toggleClass('todo-completed');
90 | return false;
91 | });
92 |
93 | // Append config box / Only for demo purpose
94 | // Uncomment on server mode to enable XHR calls
95 | $.get("skin-config.html", function (data) {
96 | if (!$('body').hasClass('no-skin-config'))
97 | $('body').append(data);
98 | });
99 |
100 | // Minimalize menu
101 | $('.navbar-minimalize').click(function () {
102 | $("body").toggleClass("mini-navbar");
103 | SmoothlyMenu();
104 |
105 | });
106 |
107 | // Tooltips demo
108 | $('.tooltip-demo').tooltip({
109 | selector: "[data-toggle=tooltip]",
110 | container: "body"
111 | });
112 |
113 | // Move modal to body
114 | // Fix Bootstrap backdrop issu with animation.css
115 | $('.modal').appendTo("body");
116 |
117 | // Full height of sidebar
118 | function fix_height() {
119 | var heightWithoutNavbar = $("body > #wrapper").height() - 61;
120 | $(".sidebard-panel").css("min-height", heightWithoutNavbar + "px");
121 |
122 | var navbarHeigh = $('nav.navbar-default').height();
123 | var wrapperHeigh = $('#page-wrapper').height();
124 |
125 | if (navbarHeigh > wrapperHeigh) {
126 | $('#page-wrapper').css("min-height", navbarHeigh + "px");
127 | }
128 |
129 | if (navbarHeigh < wrapperHeigh) {
130 | $('#page-wrapper').css("min-height", $(window).height() + "px");
131 | }
132 |
133 | if ($('body').hasClass('fixed-nav')) {
134 | $('#page-wrapper').css("min-height", $(window).height() - 60 + "px");
135 | }
136 |
137 | }
138 |
139 | fix_height();
140 |
141 | // Fixed Sidebar
142 | $(window).bind("load", function () {
143 | if ($("body").hasClass('fixed-sidebar')) {
144 | $('.sidebar-collapse').slimScroll({
145 | height: '100%',
146 | railOpacity: 0.9
147 | });
148 | }
149 | });
150 |
151 | // Move right sidebar top after scroll
152 | $(window).scroll(function () {
153 | if ($(window).scrollTop() > 0 && !$('body').hasClass('fixed-nav')) {
154 | $('#right-sidebar').addClass('sidebar-top');
155 | } else {
156 | $('#right-sidebar').removeClass('sidebar-top');
157 | }
158 | });
159 |
160 | $(window).bind("load resize scroll", function () {
161 | if (!$("body").hasClass('body-small')) {
162 | fix_height();
163 | }
164 | });
165 |
166 | $("[data-toggle=popover]")
167 | .popover();
168 |
169 | // Add slimscroll to element
170 | $('.full-height-scroll').slimscroll({
171 | height: '100%'
172 | })
173 | });
174 |
175 |
176 | // Minimalize menu when screen is less than 768px
177 | $(window).bind("resize", function () {
178 | if ($(this).width() < 769) {
179 | $('body').addClass('body-small')
180 | } else {
181 | $('body').removeClass('body-small')
182 | }
183 | });
184 |
185 | // Local Storage functions
186 | // Set proper body class and plugins based on user configuration
187 | $(document).ready(function () {
188 | if (localStorageSupport) {
189 |
190 | var collapse = localStorage.getItem("collapse_menu");
191 | var fixedsidebar = localStorage.getItem("fixedsidebar");
192 | var fixednavbar = localStorage.getItem("fixednavbar");
193 | var boxedlayout = localStorage.getItem("boxedlayout");
194 | var fixedfooter = localStorage.getItem("fixedfooter");
195 |
196 | var body = $('body');
197 |
198 | if (fixedsidebar == 'on') {
199 | body.addClass('fixed-sidebar');
200 | $('.sidebar-collapse').slimScroll({
201 | height: '100%',
202 | railOpacity: 0.9
203 | });
204 | }
205 |
206 | if (collapse == 'on') {
207 | if (body.hasClass('fixed-sidebar')) {
208 | if (!body.hasClass('body-small')) {
209 | body.addClass('mini-navbar');
210 | }
211 | } else {
212 | if (!body.hasClass('body-small')) {
213 | body.addClass('mini-navbar');
214 | }
215 |
216 | }
217 | }
218 |
219 | if (fixednavbar == 'on') {
220 | $(".navbar-static-top").removeClass('navbar-static-top').addClass('navbar-fixed-top');
221 | body.addClass('fixed-nav');
222 | }
223 |
224 | if (boxedlayout == 'on') {
225 | body.addClass('boxed-layout');
226 | }
227 |
228 | if (fixedfooter == 'on') {
229 | $(".footer").addClass('fixed');
230 | }
231 | }
232 | });
233 |
234 | // check if browser support HTML5 local storage
235 | function localStorageSupport() {
236 | return (('localStorage' in window) && window['localStorage'] !== null)
237 | }
238 |
239 | // For demo purpose - animation css script
240 | function animationHover(element, animation) {
241 | element = $(element);
242 | element.hover(
243 | function () {
244 | element.addClass('animated ' + animation);
245 | },
246 | function () {
247 | //wait for animation to finish before removing classes
248 | window.setTimeout(function () {
249 | element.removeClass('animated ' + animation);
250 | }, 2000);
251 | });
252 | }
253 |
254 | function SmoothlyMenu() {
255 | if (!$('body').hasClass('mini-navbar') || $('body').hasClass('body-small')) {
256 | // Hide menu in order to smoothly turn on when maximize menu
257 | $('#side-menu').hide();
258 | // For smoothly turn on menu
259 | setTimeout(
260 | function () {
261 | $('#side-menu').fadeIn(500);
262 | }, 100);
263 | } else if ($('body').hasClass('fixed-sidebar')) {
264 | $('#side-menu').hide();
265 | setTimeout(
266 | function () {
267 | $('#side-menu').fadeIn(500);
268 | }, 300);
269 | } else {
270 | // Remove all inline style from jquery fadeIn function to reset menu state
271 | $('#side-menu').removeAttr('style');
272 | }
273 | }
274 |
275 | // Dragable panels
276 | function WinMove() {
277 | var element = "[class*=col]";
278 | var handle = ".ibox-title";
279 | var connect = "[class*=col]";
280 | $(element).sortable(
281 | {
282 | handle: handle,
283 | connectWith: connect,
284 | tolerance: 'pointer',
285 | forcePlaceholderSize: true,
286 | opacity: 0.8
287 | })
288 | .disableSelection();
289 | }
290 |
291 |
292 |
--------------------------------------------------------------------------------
/static/pages/rulesWeb.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | add rules
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 |
39 |
40 |
41 |
42 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
告警规则预览:
93 |
groups:
94 |
- name:
95 |
rules:
96 |
- alert:
97 |
expr:
98 |
for:
99 |
labels:
100 |
level:
101 |
service:
102 |
annotations:
103 |
summary: "告警主机和端口{{ $labels.instance }} 告警值:{{ $value }}"
104 |
description:
105 |
106 |
107 |
108 |
109 |
110 |
111 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
--------------------------------------------------------------------------------
/static/pages/rulesWeb1.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | add rules
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
Prometheus
16 |
17 |
24 |
25 |
26 |
27 |
28 |
添加告警规则
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
告警规则预览:
93 |
groups:
94 |
- name:
95 |
rules:
96 |
- alert:
97 |
expr:
98 |
for:
99 |
labels:
100 |
level:
101 |
service: "local-234"
102 |
annotations:
103 |
summary: "告警主机和端口{{ $labels.instance }} 告警值:{{ $value }}"
104 |
description:
105 |
106 |
107 |
108 |
109 |
110 |
111 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
181 |
182 |
183 |
--------------------------------------------------------------------------------
/static/js/plugins/pace/pace.min.js:
--------------------------------------------------------------------------------
1 | /*! pace 1.0.0 */
2 | (function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X=[].slice,Y={}.hasOwnProperty,Z=function(a,b){function c(){this.constructor=a}for(var d in b)Y.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},$=[].indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(b in this&&this[b]===a)return b;return-1};for(u={catchupTime:100,initialRate:.03,minTime:250,ghostTime:100,maxProgressPerFrame:20,easeFactor:1.25,startOnPageLoad:!0,restartOnPushState:!0,restartOnRequestAfter:500,target:"body",elements:{checkInterval:100,selectors:["body"]},eventLag:{minSamples:10,sampleCount:3,lagThreshold:3},ajax:{trackMethods:["GET"],trackWebSockets:!0,ignoreURLs:[]}},C=function(){var a;return null!=(a="undefined"!=typeof performance&&null!==performance&&"function"==typeof performance.now?performance.now():void 0)?a:+new Date},E=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame,t=window.cancelAnimationFrame||window.mozCancelAnimationFrame,null==E&&(E=function(a){return setTimeout(a,50)},t=function(a){return clearTimeout(a)}),G=function(a){var b,c;return b=C(),(c=function(){var d;return d=C()-b,d>=33?(b=C(),a(d,function(){return E(c)})):setTimeout(c,33-d)})()},F=function(){var a,b,c;return c=arguments[0],b=arguments[1],a=3<=arguments.length?X.call(arguments,2):[],"function"==typeof c[b]?c[b].apply(c,a):c[b]},v=function(){var a,b,c,d,e,f,g;for(b=arguments[0],d=2<=arguments.length?X.call(arguments,1):[],f=0,g=d.length;g>f;f++)if(c=d[f])for(a in c)Y.call(c,a)&&(e=c[a],null!=b[a]&&"object"==typeof b[a]&&null!=e&&"object"==typeof e?v(b[a],e):b[a]=e);return b},q=function(a){var b,c,d,e,f;for(c=b=0,e=0,f=a.length;f>e;e++)d=a[e],c+=Math.abs(d),b++;return c/b},x=function(a,b){var c,d,e;if(null==a&&(a="options"),null==b&&(b=!0),e=document.querySelector("[data-pace-"+a+"]")){if(c=e.getAttribute("data-pace-"+a),!b)return c;try{return JSON.parse(c)}catch(f){return d=f,"undefined"!=typeof console&&null!==console?console.error("Error parsing inline pace options",d):void 0}}},g=function(){function a(){}return a.prototype.on=function(a,b,c,d){var e;return null==d&&(d=!1),null==this.bindings&&(this.bindings={}),null==(e=this.bindings)[a]&&(e[a]=[]),this.bindings[a].push({handler:b,ctx:c,once:d})},a.prototype.once=function(a,b,c){return this.on(a,b,c,!0)},a.prototype.off=function(a,b){var c,d,e;if(null!=(null!=(d=this.bindings)?d[a]:void 0)){if(null==b)return delete this.bindings[a];for(c=0,e=[];cQ;Q++)K=U[Q],D[K]===!0&&(D[K]=u[K]);i=function(a){function b(){return V=b.__super__.constructor.apply(this,arguments)}return Z(b,a),b}(Error),b=function(){function a(){this.progress=0}return a.prototype.getElement=function(){var a;if(null==this.el){if(a=document.querySelector(D.target),!a)throw new i;this.el=document.createElement("div"),this.el.className="pace pace-active",document.body.className=document.body.className.replace(/pace-done/g,""),document.body.className+=" pace-running",this.el.innerHTML='\n',null!=a.firstChild?a.insertBefore(this.el,a.firstChild):a.appendChild(this.el)}return this.el},a.prototype.finish=function(){var a;return a=this.getElement(),a.className=a.className.replace("pace-active",""),a.className+=" pace-inactive",document.body.className=document.body.className.replace("pace-running",""),document.body.className+=" pace-done"},a.prototype.update=function(a){return this.progress=a,this.render()},a.prototype.destroy=function(){try{this.getElement().parentNode.removeChild(this.getElement())}catch(a){i=a}return this.el=void 0},a.prototype.render=function(){var a,b,c,d,e,f,g;if(null==document.querySelector(D.target))return!1;for(a=this.getElement(),d="translate3d("+this.progress+"%, 0, 0)",g=["webkitTransform","msTransform","transform"],e=0,f=g.length;f>e;e++)b=g[e],a.children[0].style[b]=d;return(!this.lastRenderedProgress||this.lastRenderedProgress|0!==this.progress|0)&&(a.children[0].setAttribute("data-progress-text",""+(0|this.progress)+"%"),this.progress>=100?c="99":(c=this.progress<10?"0":"",c+=0|this.progress),a.children[0].setAttribute("data-progress",""+c)),this.lastRenderedProgress=this.progress},a.prototype.done=function(){return this.progress>=100},a}(),h=function(){function a(){this.bindings={}}return a.prototype.trigger=function(a,b){var c,d,e,f,g;if(null!=this.bindings[a]){for(f=this.bindings[a],g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push(c.call(this,b));return g}},a.prototype.on=function(a,b){var c;return null==(c=this.bindings)[a]&&(c[a]=[]),this.bindings[a].push(b)},a}(),P=window.XMLHttpRequest,O=window.XDomainRequest,N=window.WebSocket,w=function(a,b){var c,d,e,f;f=[];for(d in b.prototype)try{e=b.prototype[d],f.push(null==a[d]&&"function"!=typeof e?a[d]=e:void 0)}catch(g){c=g}return f},A=[],j.ignore=function(){var a,b,c;return b=arguments[0],a=2<=arguments.length?X.call(arguments,1):[],A.unshift("ignore"),c=b.apply(null,a),A.shift(),c},j.track=function(){var a,b,c;return b=arguments[0],a=2<=arguments.length?X.call(arguments,1):[],A.unshift("track"),c=b.apply(null,a),A.shift(),c},J=function(a){var b;if(null==a&&(a="GET"),"track"===A[0])return"force";if(!A.length&&D.ajax){if("socket"===a&&D.ajax.trackWebSockets)return!0;if(b=a.toUpperCase(),$.call(D.ajax.trackMethods,b)>=0)return!0}return!1},k=function(a){function b(){var a,c=this;b.__super__.constructor.apply(this,arguments),a=function(a){var b;return b=a.open,a.open=function(d,e){return J(d)&&c.trigger("request",{type:d,url:e,request:a}),b.apply(a,arguments)}},window.XMLHttpRequest=function(b){var c;return c=new P(b),a(c),c};try{w(window.XMLHttpRequest,P)}catch(d){}if(null!=O){window.XDomainRequest=function(){var b;return b=new O,a(b),b};try{w(window.XDomainRequest,O)}catch(d){}}if(null!=N&&D.ajax.trackWebSockets){window.WebSocket=function(a,b){var d;return d=null!=b?new N(a,b):new N(a),J("socket")&&c.trigger("request",{type:"socket",url:a,protocols:b,request:d}),d};try{w(window.WebSocket,N)}catch(d){}}}return Z(b,a),b}(h),R=null,y=function(){return null==R&&(R=new k),R},I=function(a){var b,c,d,e;for(e=D.ajax.ignoreURLs,c=0,d=e.length;d>c;c++)if(b=e[c],"string"==typeof b){if(-1!==a.indexOf(b))return!0}else if(b.test(a))return!0;return!1},y().on("request",function(b){var c,d,e,f,g;return f=b.type,e=b.request,g=b.url,I(g)?void 0:j.running||D.restartOnRequestAfter===!1&&"force"!==J(f)?void 0:(d=arguments,c=D.restartOnRequestAfter||0,"boolean"==typeof c&&(c=0),setTimeout(function(){var b,c,g,h,i,k;if(b="socket"===f?e.readyState<2:0<(h=e.readyState)&&4>h){for(j.restart(),i=j.sources,k=[],c=0,g=i.length;g>c;c++){if(K=i[c],K instanceof a){K.watch.apply(K,d);break}k.push(void 0)}return k}},c))}),a=function(){function a(){var a=this;this.elements=[],y().on("request",function(){return a.watch.apply(a,arguments)})}return a.prototype.watch=function(a){var b,c,d,e;return d=a.type,b=a.request,e=a.url,I(e)?void 0:(c="socket"===d?new n(b):new o(b),this.elements.push(c))},a}(),o=function(){function a(a){var b,c,d,e,f,g,h=this;if(this.progress=0,null!=window.ProgressEvent)for(c=null,a.addEventListener("progress",function(a){return h.progress=a.lengthComputable?100*a.loaded/a.total:h.progress+(100-h.progress)/2},!1),g=["load","abort","timeout","error"],d=0,e=g.length;e>d;d++)b=g[d],a.addEventListener(b,function(){return h.progress=100},!1);else f=a.onreadystatechange,a.onreadystatechange=function(){var b;return 0===(b=a.readyState)||4===b?h.progress=100:3===a.readyState&&(h.progress=50),"function"==typeof f?f.apply(null,arguments):void 0}}return a}(),n=function(){function a(a){var b,c,d,e,f=this;for(this.progress=0,e=["error","open"],c=0,d=e.length;d>c;c++)b=e[c],a.addEventListener(b,function(){return f.progress=100},!1)}return a}(),d=function(){function a(a){var b,c,d,f;for(null==a&&(a={}),this.elements=[],null==a.selectors&&(a.selectors=[]),f=a.selectors,c=0,d=f.length;d>c;c++)b=f[c],this.elements.push(new e(b))}return a}(),e=function(){function a(a){this.selector=a,this.progress=0,this.check()}return a.prototype.check=function(){var a=this;return document.querySelector(this.selector)?this.done():setTimeout(function(){return a.check()},D.elements.checkInterval)},a.prototype.done=function(){return this.progress=100},a}(),c=function(){function a(){var a,b,c=this;this.progress=null!=(b=this.states[document.readyState])?b:100,a=document.onreadystatechange,document.onreadystatechange=function(){return null!=c.states[document.readyState]&&(c.progress=c.states[document.readyState]),"function"==typeof a?a.apply(null,arguments):void 0}}return a.prototype.states={loading:0,interactive:50,complete:100},a}(),f=function(){function a(){var a,b,c,d,e,f=this;this.progress=0,a=0,e=[],d=0,c=C(),b=setInterval(function(){var g;return g=C()-c-50,c=C(),e.push(g),e.length>D.eventLag.sampleCount&&e.shift(),a=q(e),++d>=D.eventLag.minSamples&&a=100&&(this.done=!0),b===this.last?this.sinceLastUpdate+=a:(this.sinceLastUpdate&&(this.rate=(b-this.last)/this.sinceLastUpdate),this.catchup=(b-this.progress)/D.catchupTime,this.sinceLastUpdate=0,this.last=b),b>this.progress&&(this.progress+=this.catchup*a),c=1-Math.pow(this.progress/100,D.easeFactor),this.progress+=c*this.rate*a,this.progress=Math.min(this.lastProgress+D.maxProgressPerFrame,this.progress),this.progress=Math.max(0,this.progress),this.progress=Math.min(100,this.progress),this.lastProgress=this.progress,this.progress},a}(),L=null,H=null,r=null,M=null,p=null,s=null,j.running=!1,z=function(){return D.restartOnPushState?j.restart():void 0},null!=window.history.pushState&&(T=window.history.pushState,window.history.pushState=function(){return z(),T.apply(window.history,arguments)}),null!=window.history.replaceState&&(W=window.history.replaceState,window.history.replaceState=function(){return z(),W.apply(window.history,arguments)}),l={ajax:a,elements:d,document:c,eventLag:f},(B=function(){var a,c,d,e,f,g,h,i;for(j.sources=L=[],g=["ajax","elements","document","eventLag"],c=0,e=g.length;e>c;c++)a=g[c],D[a]!==!1&&L.push(new l[a](D[a]));for(i=null!=(h=D.extraSources)?h:[],d=0,f=i.length;f>d;d++)K=i[d],L.push(new K(D));return j.bar=r=new b,H=[],M=new m})(),j.stop=function(){return j.trigger("stop"),j.running=!1,r.destroy(),s=!0,null!=p&&("function"==typeof t&&t(p),p=null),B()},j.restart=function(){return j.trigger("restart"),j.stop(),j.start()},j.go=function(){var a;return j.running=!0,r.render(),a=C(),s=!1,p=G(function(b,c){var d,e,f,g,h,i,k,l,n,o,p,q,t,u,v,w;for(l=100-r.progress,e=p=0,f=!0,i=q=0,u=L.length;u>q;i=++q)for(K=L[i],o=null!=H[i]?H[i]:H[i]=[],h=null!=(w=K.elements)?w:[K],k=t=0,v=h.length;v>t;k=++t)g=h[k],n=null!=o[k]?o[k]:o[k]=new m(g),f&=n.done,n.done||(e++,p+=n.tick(b));return d=p/e,r.update(M.tick(b,d)),r.done()||f||s?(r.update(100),j.trigger("done"),setTimeout(function(){return r.finish(),j.running=!1,j.trigger("hide")},Math.max(D.ghostTime,Math.max(D.minTime-(C()-a),0)))):c()})},j.start=function(a){v(D,a),j.running=!0;try{r.render()}catch(b){i=b}return document.querySelector(".pace")?(j.trigger("start"),j.go()):setTimeout(j.start,50)},"function"==typeof define&&define.amd?define(function(){return j}):"object"==typeof exports?module.exports=j:D.startOnPageLoad&&j.start()}).call(this);
--------------------------------------------------------------------------------
/static/js/plugins/ionRangeSlider/ion.rangeSlider.min.js:
--------------------------------------------------------------------------------
1 | // Ion.RangeSlider | version 1.9.1 | https://github.com/IonDen/ion.rangeSlider
2 | (function(c,ea,$,M){var aa=0,s,S=function(){var c=M.userAgent,a=/msie\s\d+/i;return 0c)?!0:!1}(),X="ontouchstart"in $||0a.max&&(a.from=a.min);a.toa.max&&(a.to=a.max);"double"===a.type&&(a.from>a.to&&(a.from=a.to),a.to';e[0].style.display="none";e.before(g);var p=e.prev(),J=c(ea.body),T=c($),q,C,D,A,B,w,x,m,t,r,H,M,v=!1,y=!1,E=!0,f={},U=0,O=0,P=0,l=0,F=0,G=0,V=0,Q=0,R=0,Y=0,u=0;parseInt(a.step,
8 | 10)!==parseFloat(a.step)&&(u=a.step.toString().split(".")[1],u=Math.pow(10,u.length));this.updateData=function(b){E=!0;a=c.extend(a,b);p.find("*").off();T.off("mouseup.irs"+n.pluginCount);J.off("mouseup.irs"+n.pluginCount);J.off("mousemove.irs"+n.pluginCount);p.html("");ba()};this.removeSlider=function(){p.find("*").off();T.off("mouseup.irs"+n.pluginCount);J.off("mouseup.irs"+n.pluginCount);J.off("mousemove.irs"+n.pluginCount);p.html("").remove();e.data("isActive",!1);e.show()};var ba=function(){p.html('01000');
9 | q=p.find(".irs");C=q.find(".irs-min");D=q.find(".irs-max");A=q.find(".irs-from");B=q.find(".irs-to");w=q.find(".irs-single");M=p.find(".irs-grid");a.hideFromTo&&(A[0].style.visibility="hidden",B[0].style.visibility="hidden",w[0].style.visibility="hidden");a.hideFromTo||(A[0].style.visibility="visible",B[0].style.visibility="visible",w[0].style.visibility="visible");a.hideMinMax&&(C[0].style.visibility="hidden",D[0].style.visibility="hidden",P=O=0);a.hideMinMax||(C[0].style.visibility="visible",D[0].style.visibility=
10 | "visible",a.values?(C.html(a.prefix+a.values[0]+a.postfix),D.html(a.prefix+a.values[a.values.length-1]+a.maxPostfix+a.postfix)):(C.html(a.prefix+z(a.min)+a.postfix),D.html(a.prefix+z(a.max)+a.maxPostfix+a.postfix)),O=C.outerWidth(),P=D.outerWidth());ga()},ga=function(){if("single"===a.type){if(q.append(''),x=q.find(".single"),x.on("mousedown",function(a){a.preventDefault();a.stopPropagation();K(a,c(this),null);y=v=!0;s=n.pluginCount;S&&c("*").prop("unselectable",
11 | !0)}),X)x.on("touchstart",function(a){a.preventDefault();a.stopPropagation();K(a.originalEvent.touches[0],c(this),null);y=v=!0;s=n.pluginCount})}else"double"===a.type&&(q.append(''),m=q.find(".from"),t=q.find(".to"),H=q.find(".irs-diapason"),L(),m.on("mousedown",function(a){a.preventDefault();a.stopPropagation();c(this).addClass("last");t.removeClass("last");K(a,c(this),"from");y=v=!0;s=n.pluginCount;
12 | S&&c("*").prop("unselectable",!0)}),t.on("mousedown",function(a){a.preventDefault();a.stopPropagation();c(this).addClass("last");m.removeClass("last");K(a,c(this),"to");y=v=!0;s=n.pluginCount;S&&c("*").prop("unselectable",!0)}),X&&(m.on("touchstart",function(a){a.preventDefault();a.stopPropagation();c(this).addClass("last");t.removeClass("last");K(a.originalEvent.touches[0],c(this),"from");y=v=!0;s=n.pluginCount}),t.on("touchstart",function(a){a.preventDefault();a.stopPropagation();c(this).addClass("last");
13 | m.removeClass("last");K(a.originalEvent.touches[0],c(this),"to");y=v=!0;s=n.pluginCount})),a.to===a.max&&m.addClass("last"));J.on("mouseup.irs"+n.pluginCount,function(){s===n.pluginCount&&v&&(v=y=!1,r.removeAttr("id"),r=null,"double"===a.type&&L(),Z(),S&&c("*").prop("unselectable",!1))});J.on("mousemove.irs"+n.pluginCount,function(a){v&&(U=a.pageX,W())});p.on("mousedown",function(){s=n.pluginCount});p.on("mouseup",function(b){if(s===n.pluginCount&&!v&&!a.disable){b=b.pageX;E=!1;b-=p.offset().left;
14 | var d=f.fromX+(f.toX-f.fromX)/2;Q=0;V=q.width()-G;R=q.width()-G;"single"===a.type?(r=x,r.attr("id","irs-active-slider"),W(b)):"double"===a.type&&(r=b<=d?m:t,r.attr("id","irs-active-slider"),W(b),L());r.removeAttr("id");r=null}});X&&(T.on("touchend",function(){v&&(v=y=!1,r.removeAttr("id"),r=null,"double"===a.type&&L(),Z())}),T.on("touchmove",function(a){v&&(U=a.originalEvent.touches[0].pageX,W())}));ca();ha();a.hasGrid&&ia();a.disable?(p.addClass("irs-disabled"),p.append('')):
15 | (p.removeClass("irs-disabled"),p.find(".irs-disable-mask").remove())},ca=function(){l=q.width();G=x?x.width():m.width();F=l-G},K=function(b,d,h){ca();E=!1;r=d;r.attr("id","irs-active-slider");d=r.offset().left;Y=d+(b.pageX-d)-r.position().left;"single"===a.type?V=q.width()-G:"double"===a.type&&("from"===h?(Q=0,R=parseInt(t.css("left"),10)):(Q=parseInt(m.css("left"),10),R=q.width()-G))},L=function(){var a=m.width(),d=c.data(m[0],"x")||parseInt(m[0].style.left,10)||m.position().left,h=(c.data(t[0],
16 | "x")||parseInt(t[0].style.left,10)||t.position().left)-d;H[0].style.left=d+a/2+"px";H[0].style.width=h+"px"},W=function(b){var d=U-Y,d=b?b:U-Y;"single"===a.type?(0>d&&(d=0),d>V&&(d=V)):"double"===a.type&&(dR&&(d=R),L());c.data(r[0],"x",d);Z();b=Math.round(d);r[0].style.left=b+"px"},Z=function(){var b={input:e,slider:p,min:a.min,max:a.max,fromNumber:0,toNumber:0,fromPers:0,toPers:0,fromX:0,fromX_pure:0,toX:0,toX_pure:0},d=a.max-a.min,h;"single"===a.type?(b.fromX=c.data(x[0],"x")||parseInt(x[0].style.left,
17 | 10)||x.position().left,b.fromPers=b.fromX/F*100,h=d/100*b.fromPers+a.min,b.fromNumber=Math.round(h/a.step)*a.step,b.fromNumbera.max&&(b.fromNumber=a.max),u&&(b.fromNumber=parseInt(b.fromNumber*u,10)/u),I&&(b.fromValue=a.values[b.fromNumber])):"double"===a.type&&(b.fromX=c.data(m[0],"x")||parseInt(m[0].style.left,10)||m.position().left,b.fromPers=b.fromX/F*100,h=d/100*b.fromPers+a.min,b.fromNumber=Math.round(h/a.step)*a.step,b.fromNumbera.max&&(b.toNumber=a.max),u&&(b.fromNumber=parseInt(b.fromNumber*u,10)/u,b.toNumber=parseInt(b.toNumber*u,10)/u),I&&(b.fromValue=a.values[b.fromNumber],b.toValue=a.values[b.toNumber]));f=b;da()},ha=function(){var b={input:e,slider:p,min:a.min,max:a.max,fromNumber:a.from,toNumber:a.to,fromPers:0,toPers:0,fromX:0,fromX_pure:0,toX:0,
19 | toX_pure:0},d=a.max-a.min;"single"===a.type?(b.fromPers=0!==d?(b.fromNumber-a.min)/d*100:0,b.fromX_pure=F/100*b.fromPers,b.fromX=Math.round(b.fromX_pure),x[0].style.left=b.fromX+"px",c.data(x[0],"x",b.fromX_pure)):"double"===a.type&&(b.fromPers=0!==d?(b.fromNumber-a.min)/d*100:0,b.fromX_pure=F/100*b.fromPers,b.fromX=Math.round(b.fromX_pure),m[0].style.left=b.fromX+"px",c.data(m[0],"x",b.fromX_pure),b.toPers=0!==d?(b.toNumber-a.min)/d*100:1,b.toX_pure=F/100*b.toPers,b.toX=Math.round(b.toX_pure),t[0].style.left=
20 | b.toX+"px",c.data(t[0],"x",b.toX_pure),L());f=b;da()},da=function(){var b,d,h,c,g,k;k=G/2;h="";"single"===a.type?(h=f.fromNumber===a.max?a.maxPostfix:"",A[0].style.display="none",B[0].style.display="none",h=I?a.prefix+a.values[f.fromNumber]+h+a.postfix:a.prefix+z(f.fromNumber)+h+a.postfix,w.html(h),g=w.outerWidth(),k=f.fromX-g/2+k,0>k&&(k=0),k>l-g&&(k=l-g),w[0].style.left=k+"px",a.hideMinMax||a.hideFromTo||(C[0].style.display=kl-P?"none":"block"),e.attr("value",
21 | parseFloat(f.fromNumber))):"double"===a.type&&(h=f.toNumber===a.max?a.maxPostfix:"",I?(b=a.prefix+a.values[f.fromNumber]+a.postfix,d=a.prefix+a.values[f.toNumber]+h+a.postfix,h=f.fromNumber!==f.toNumber?a.prefix+a.values[f.fromNumber]+" \u2014 "+a.prefix+a.values[f.toNumber]+h+a.postfix:a.prefix+a.values[f.fromNumber]+h+a.postfix):(b=a.prefix+z(f.fromNumber)+a.postfix,d=a.prefix+z(f.toNumber)+h+a.postfix,h=f.fromNumber!==f.toNumber?a.prefix+z(f.fromNumber)+" \u2014 "+a.prefix+z(f.toNumber)+h+a.postfix:
22 | a.prefix+z(f.fromNumber)+h+a.postfix),A.html(b),B.html(d),w.html(h),b=A.outerWidth(),d=f.fromX-b/2+k,0>d&&(d=0),d>l-b&&(d=l-b),A[0].style.left=d+"px",h=B.outerWidth(),c=f.toX-h/2+k,0>c&&(c=0),c>l-h&&(c=l-h),B[0].style.left=c+"px",g=w.outerWidth(),k=f.fromX+(f.toX-f.fromX)/2-g/2+k,0>k&&(k=0),k>l-g&&(k=l-g),w[0].style.left=k+"px",d+bl-P||c+h>l-P?"none":"block"),e.attr("value",parseFloat(f.fromNumber)+";"+parseFloat(f.toNumber)));ja()},ja=function(){"function"!==typeof a.onFinish||y||E||a.onFinish.call(this,f);"function"!==typeof a.onChange||E||a.onChange.call(this,f);"function"===typeof a.onLoad&&!y&&E&&(a.onLoad.call(this,f),E=!1)},ia=function(){p.addClass("irs-with-grid");var b,d="",c=0,c=0,e="";for(b=0;20>=b;b+=1)c=Math.floor(l/20*b),c>=l&&(c=
24 | l-1),e+='';for(b=0;4>=b;b+=1)c=Math.floor(l/4*b),c>=l&&(c=l-1),e+='',u?(d=a.min+(a.max-a.min)/4*b,d=d/a.step*a.step,d=parseInt(d*u,10)/u):(d=Math.round(a.min+(a.max-a.min)/4*b),d=Math.round(d/a.step)*a.step,d=z(d)),I&&(a.hideMinMax?(d=Math.round(a.min+(a.max-a.min)/4*b),d=Math.round(d/a.step)*a.step,d=0===b||4===b?a.values[d]:""):d=""),0===b?e+=''+d+"":4===b?(c-=100,e+=''+d+""):(c-=50,e+=''+d+"");M.html(e)};ba()}})},update:function(c){return this.each(function(){this.updateData(c)})},remove:function(){return this.each(function(){this.removeSlider()})}};c.fn.ionRangeSlider=function(s){if(H[s])return H[s].apply(this,Array.prototype.slice.call(arguments,1));if("object"!==typeof s&&
26 | s)c.error("Method "+s+" does not exist for jQuery.ionRangeSlider");else return H.init.apply(this,arguments)}})(jQuery,document,window,navigator);
--------------------------------------------------------------------------------
/static/js/plugins/nouslider/jquery.nouislider.min.js:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | $.classVal - WTFPL - refreshless.com/classval/ */
4 | (function(b){function h(a,e){var d=!1;b.each(a?q:g,function(a){if(b(e).hasClass(a))return d=a,!1});return d}var n=b.fn.val,g={},q={},u={};b.classVal=function(a,b,d,l){"string"===typeof a&&"boolean"===typeof l&&(b&&(g[a]=b),d&&(q[a]=d),u[a]=l)};b.fn.val=function(){var a=Array.prototype.slice.call(arguments,0),e,d;return a.length?this.each(function(){(e=h(!0,this))?(d=u[e]?b(this):this,d[q[e]].apply(this,a)):n.apply(b(this),a)}):(e=h(!1,this))?(d=u[e]?this:this[0],d[g[e]].apply(d)):n.apply(this)}})(window.jQuery||
5 | window.Zepto);/*
6 |
7 | $.Link (part of noUiSlider) - WTFPL */
8 | (function(b){function h(a,b,d){if((a[b]||a[d])&&a[b]===a[d])throw Error("(Link) '"+b+"' can't match '"+d+"'.'");}function n(a){void 0===a&&(a={});if("object"!==typeof a)throw Error("(Format) 'format' option must be an object.");var e={};b(q).each(function(b,l){if(void 0===a[l])e[l]=u[b];else if(typeof a[l]===typeof u[b]){if("decimals"===l&&(0>a[l]||7a&&(l=this.a("negative"),g=this.a("negativeBefore"));a=Math.abs(a).toFixed(d).toString();a=a.split(".");this.a("thousand")?(h=b(a[0]).match(/.{1,3}/g),h=b(h.join(b(this.a("thousand"))))):h=a[0];this.a("mark")&&1")[0]};g.prototype.H=function(a){this.method="val";this.j=document.createElement("input");this.j.name=a;this.j.type="hidden"};g.prototype.G=function(a){function e(a,b){return[b?null:a,b?a:null]}var d=this;this.method="val";this.target=a.on("change",function(a){d.B.val(e(b(a.target).val(),d.t),{link:d,set:!0})})};g.prototype.p=function(a,e,d,g){this.g=d;this.update=!g;if("string"===
13 | typeof a&&0===a.indexOf("-tooltip-"))this.K(a,e);else if("string"===typeof a&&0!==a.indexOf("-"))this.H(a);else if("function"===typeof a)this.target=!1,this.method=a;else{if(a instanceof b||b.zepto&&b.zepto.isZ(a)){if(!e){if(a.is("input, select, textarea")){this.G(a);return}e="html"}if("function"===typeof e||"string"===typeof e&&a[e]){this.method=e;this.target=a;return}}throw new RangeError("(Link) Invalid Link.");}};g.prototype.write=function(a,b,d,g){if(!this.update||!1!==g)if(this.u=a,this.F=a=
14 | this.format(a),"function"===typeof this.method)this.method.call(this.target[0]||d[0],a,b,d);else this.target[this.method](a,b,d)};g.prototype.q=function(a){this.g=new n(b.extend({},a,this.g instanceof n?this.g.r:this.g))};g.prototype.J=function(a){this.B=a};g.prototype.I=function(a){this.t=a};g.prototype.format=function(a){return this.g.L(a)};g.prototype.A=function(a){return this.g.w(a)};g.prototype.p.prototype=g.prototype;b.Link=g})(window.jQuery||window.Zepto);/*
15 |
16 | $.fn.noUiSlider - WTFPL - refreshless.com/nouislider/ */
17 | (function(b){function h(a){return"number"===typeof a&&!isNaN(a)&&isFinite(a)}function n(a){return b.isArray(a)?a:[a]}function g(a,c){a.addClass(c);setTimeout(function(){a.removeClass(c)},300)}function q(a,c){return 100*c/(a[1]-a[0])}function u(a,c){if(c>=a.d.slice(-1)[0])return 100;for(var b=1,f,d,e;c>=a.d[b];)b++;f=a.d[b-1];d=a.d[b];e=a.c[b-1];f=[f,d];return e+q(f,0>f[0]?c+Math.abs(f[0]):c-f[0])/(100/(a.c[b]-e))}function a(a,c){if(100<=c)return a.d.slice(-1)[0];for(var b=1,f,d,e;c>=a.c[b];)b++;f=
18 | a.d[b-1];d=a.d[b];e=a.c[b-1];f=[f,d];return 100/(a.c[b]-e)*(c-e)*(f[1]-f[0])/100+f[0]}function e(a,c){for(var b=1,f;c>=a.c[b];)b++;if(a.m)return f=a.c[b-1],b=a.c[b],c-f>(b-f)/2?b:f;a.h[b-1]?(f=a.h[b-1],b=a.c[b-1]+Math.round((c-a.c[b-1])/f)*f):b=c;return b}function d(a,c){if(!h(c))throw Error("noUiSlider: 'step' is not numeric.");a.h[0]=c}function l(a,c){if("object"!==typeof c||b.isArray(c))throw Error("noUiSlider: 'range' is not an object.");b.each(c,function(c,f){var d;"number"===typeof f&&(f=[f]);
19 | if(!b.isArray(f))throw Error("noUiSlider: 'range' contains invalid value.");d="min"===c?0:"max"===c?100:parseFloat(c);if(!h(d)||!h(f[0]))throw Error("noUiSlider: 'range' value isn't numeric.");a.c.push(d);a.d.push(f[0]);d?a.h.push(isNaN(f[1])?!1:f[1]):isNaN(f[1])||(a.h[0]=f[1])});b.each(a.h,function(c,b){if(!b)return!0;a.h[c]=q([a.d[c],a.d[c+1]],b)/(100/(a.c[c+1]-a.c[c]))})}function z(a,c){"number"===typeof c&&(c=[c]);if(!b.isArray(c)||!c.length||2").addClass(k[2]),f=["-lower","-upper"];a.dir&&f.reverse();d.children().addClass(k[3]+" "+k[3]+f[c]);return d}function O(a,c){c.j&&(c=new b.Link({target:b(c.j).clone().appendTo(a),method:c.method,format:c.g},!0));return c}function P(a,c){var d,f=[];for(d=0;d").appendTo(c).addClass(k[1])}function T(d,c,h){function f(){return r[["width","height"][c.k]]()}function l(a){var b,c=[s.val()];for(b=0;bp&&(p=e(c,p));p=Math.max(Math.min(parseFloat(p.toFixed(7)),100),0);if(p===v[g])return 1===m.length?!1:p===H||p===l?0:!1;d.css(c.style,p+"%");d.is(":first-child")&&d.toggleClass(k[17],50d&&(e+=Math.abs(d)),100