Show More
@@ -1,138 +1,145 b'' | |||
|
1 | 1 | |
|
2 | 2 | <div id="update_notice" style="display: none; margin: -40px 0px 20px 0px"> |
|
3 | 3 | <div>${_('Checking for updates...')}</div> |
|
4 | 4 | </div> |
|
5 | 5 | |
|
6 | 6 | |
|
7 | 7 | <div class="panel panel-default"> |
|
8 | 8 | <div class="panel-heading"> |
|
9 | 9 | <h3 class="panel-title">${_('Gunicorn process management')}</h3> |
|
10 | 10 | <div class="pull-right"> |
|
11 | 11 | <a id="autoRefreshEnable" href="#autoRefreshEnable" onclick="enableAutoRefresh(); return false">${_('start auto refresh')}</a> |
|
12 | 12 | <a id="autoRefreshDisable" href="#autoRefreshDisable" onclick="disableAutoRefresh(); return false" style="display: none">${_('stop auto refresh')}</a> |
|
13 | 13 | </div> |
|
14 | 14 | </div> |
|
15 | 15 | <div class="panel-body" id="app"> |
|
16 | 16 | <h3>List of Gunicorn processes on this machine</h3> |
|
17 | 17 | <% |
|
18 | 18 | def get_name(proc): |
|
19 | 19 | cmd = ' '.join(proc.cmdline()) |
|
20 | 20 | if 'vcsserver.ini' in cmd: |
|
21 | 21 | return 'VCSServer' |
|
22 | 22 | elif 'rhodecode.ini' in cmd: |
|
23 | 23 | return 'RhodeCode' |
|
24 | 24 | return proc.name() |
|
25 | 25 | %> |
|
26 | 26 | <%include file='settings_process_management_data.mako'/> |
|
27 | 27 | </div> |
|
28 | 28 | </div> |
|
29 | 29 | |
|
30 | 30 | <script> |
|
31 | 31 | |
|
32 | 32 | |
|
33 | 33 | restart = function(elem, pid) { |
|
34 | 34 | |
|
35 | 35 | if ($(elem).hasClass('disabled')){ |
|
36 | 36 | return; |
|
37 | 37 | } |
|
38 | 38 | $(elem).addClass('disabled'); |
|
39 | 39 | $(elem).html('processing...'); |
|
40 | 40 | |
|
41 | 41 | $.ajax({ |
|
42 | 42 | url: pyroutes.url('admin_settings_process_management_signal'), |
|
43 | 43 | headers: { |
|
44 | 44 | "X-CSRF-Token": CSRF_TOKEN, |
|
45 | 45 | }, |
|
46 | 46 | data: JSON.stringify({'pids': [pid]}), |
|
47 | 47 | dataType: 'json', |
|
48 | 48 | type: 'POST', |
|
49 | 49 | contentType: "application/json; charset=utf-8", |
|
50 | 50 | success: function (data) { |
|
51 | 51 | $(elem).html(data.result); |
|
52 | 52 | $(elem).removeClass('disabled'); |
|
53 | 53 | }, |
|
54 | 54 | failure: function (data) { |
|
55 | 55 | $(elem).text('FAILED TO LOAD RESULT'); |
|
56 | 56 | $(elem).removeClass('disabled'); |
|
57 | 57 | }, |
|
58 | 58 | error: function (data) { |
|
59 | 59 | $(elem).text('FAILED TO LOAD RESULT'); |
|
60 | 60 | $(elem).removeClass('disabled'); |
|
61 | 61 | } |
|
62 | 62 | }) |
|
63 | 63 | }; |
|
64 | 64 | |
|
65 | 65 | var intervalID = null; |
|
66 | 66 | var currentRequest = null; |
|
67 | 67 | |
|
68 | 68 | autoRefresh = function(value) { |
|
69 | 69 | var url = pyroutes.url('admin_settings_process_management_data'); |
|
70 | 70 | var loadData = function() { |
|
71 | 71 | currentRequest = $.get(url) |
|
72 | 72 | .done(function(data) { |
|
73 | ||
|
74 | if(data.indexOf('id="processTimeStamp"') === -1){ | |
|
75 | clearInterval(intervalID); | |
|
76 | $('#procList').html('ERROR LOADING DATA. PLEASE REFRESH THE PAGE'); | |
|
77 | return | |
|
78 | } | |
|
79 | ||
|
73 | 80 | currentRequest = null; |
|
74 | 81 | $('#procList').html(data); |
|
75 | 82 | timeagoActivate(); |
|
76 | 83 | var beat = function(doCallback) { |
|
77 | 84 | var callback = function () {}; |
|
78 | 85 | if (doCallback){ |
|
79 | 86 | var callback = function () {beat(false)}; |
|
80 | 87 | } |
|
81 | 88 | $('#processTimeStamp').animate({ |
|
82 | 89 | opacity: $('#processTimeStamp').css('opacity') == '1' ? '0.3' : '1' |
|
83 | 90 | }, 500, callback); |
|
84 | 91 | }; |
|
85 | 92 | beat(true) |
|
86 | 93 | }); |
|
87 | 94 | }; |
|
88 | 95 | |
|
89 | 96 | if (value) { |
|
90 | 97 | intervalID = setInterval(loadData, 5000); |
|
91 | 98 | } else { |
|
92 | 99 | clearInterval(intervalID); |
|
93 | 100 | } |
|
94 | 101 | }; |
|
95 | 102 | |
|
96 | 103 | enableAutoRefresh = function() { |
|
97 | 104 | $('#autoRefreshEnable').hide(); |
|
98 | 105 | $('#autoRefreshDisable').show(); |
|
99 | 106 | autoRefresh(true) |
|
100 | 107 | }; |
|
101 | 108 | |
|
102 | 109 | disableAutoRefresh = function() { |
|
103 | 110 | $('#autoRefreshEnable').show(); |
|
104 | 111 | $('#autoRefreshDisable').hide(); |
|
105 | 112 | autoRefresh(false) |
|
106 | 113 | }; |
|
107 | 114 | |
|
108 | 115 | masterAction = function(pid, action) { |
|
109 | 116 | $.ajax({ |
|
110 | 117 | url: pyroutes.url('admin_settings_process_management_master_signal'), |
|
111 | 118 | headers: { |
|
112 | 119 | "X-CSRF-Token": CSRF_TOKEN, |
|
113 | 120 | }, |
|
114 | 121 | data: JSON.stringify({'pid_data': {'pid': pid, 'action': action}}), |
|
115 | 122 | dataType: 'json', |
|
116 | 123 | type: 'POST', |
|
117 | 124 | contentType: "application/json; charset=utf-8", |
|
118 | 125 | success: function (data) { |
|
119 | 126 | |
|
120 | 127 | }, |
|
121 | 128 | failure: function (data) { |
|
122 | 129 | |
|
123 | 130 | }, |
|
124 | 131 | error: function (data) { |
|
125 | 132 | |
|
126 | 133 | } |
|
127 | 134 | }) |
|
128 | 135 | }; |
|
129 | 136 | |
|
130 | 137 | addWorker = function(pid) { |
|
131 | 138 | masterAction(pid, '+'); |
|
132 | 139 | }; |
|
133 | 140 | |
|
134 | 141 | removeWorker = function(pid) { |
|
135 | 142 | masterAction(pid, '-'); |
|
136 | 143 | }; |
|
137 | 144 | |
|
138 | 145 | </script> |
General Comments 0
You need to be logged in to leave comments.
Login now