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