rabbitmq-server/deps/rabbitmq_management/priv/www/js/main.js

1724 lines
53 KiB
JavaScript
Raw Normal View History

$(document).ready(function() {
2022-05-26 22:49:07 +08:00
var url_string = window.location.href;
var url = new URL(url_string);
var error = url.searchParams.get('error');
2022-05-26 22:49:07 +08:00
if (error) {
renderWarningMessageInLoginStatus(fmt_escape_html(error));
} else {
if (oauth.enabled) {
startWithOAuthLogin();
2022-05-26 22:49:07 +08:00
} else {
startWithLoginPage();
2022-05-26 22:49:07 +08:00
}
}
});
function startWithLoginPage() {
replace_content('outer', format('login', {}));
start_app_login();
}
function startWithOAuthLogin () {
if (!oauth.logged_in) {
if (oauth.sp_initiated) {
get(oauth.readiness_url, 'application/json', function (req) {
if (req.status !== 200) {
renderWarningMessageInLoginStatus(oauth.authority + ' does not appear to be a running OAuth2.0 instance or may not have a trusted SSL certificate')
} else {
replace_content('outer', format('login_oauth', {}))
start_app_login()
}
})
} else {
replace_content('outer', format('login_oauth', {}))
start_app_login()
}
} else {
start_app_login()
}
}
function renderWarningMessageInLoginStatus (message) {
replace_content('outer', format('login_oauth', {}))
replace_content('login-status', '<p class="warning">' + message + '</p> <button id="loginWindow" onclick="oauth_initiateLogin()">Click here to log in</button>')
}
function dispatcher_add(fun) {
dispatcher_modules.push(fun);
if (dispatcher_modules.length == extension_count) {
start_app();
}
}
function dispatcher() {
for (var i in dispatcher_modules) {
dispatcher_modules[i](this);
}
}
2013-10-10 00:55:23 +08:00
function getParameterByName(name) {
var match = RegExp('[#&]' + name + '=([^&]*)').exec(window.location.hash);
return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
}
function getAccessToken() {
return getParameterByName('access_token');
}
function start_app_login () {
app = new Sammy.Application(function () {
this.get('/', function () {})
this.get('#/', function () {})
if (!oauth.enabled) {
this.put('#/login', function() {
set_basic_auth(this.params['username'], this.params['password'])
check_login()
});
}
})
// TODO REFACTOR: this code can be simplified
if (oauth.enabled) {
if (has_auth_credentials()) {
check_login();
} else {
app.run();
}
} else
if (!has_auth_credentials() || !check_login()) {
app.run();
}
}
function check_login () {
user = JSON.parse(sync_get('/whoami'));
if (user == false || user.error) {
clear_auth();
if (oauth.enabled) {
hide_popup_warn();
renderWarningMessageInLoginStatus('Not authorized');
} else {
replace_content('login-status', '<p>Login failed</p>');
}
return false;
}
hide_popup_warn()
replace_content('outer', format('layout', {}))
var user_login_session_timeout = parseInt(user.login_session_timeout)
if (!isNaN(user_login_session_timeout)) {
update_login_session_timeout(user_login_session_timeout)
}
setup_global_vars()
setup_constant_events()
update_vhosts()
update_interval()
setup_extensions()
return true
}
function start_app() {
2013-10-10 00:24:41 +08:00
if (app !== undefined) {
app.unload();
}
// Oh boy. Sammy uses various different methods to determine if
// the URL hash has changed. Unsurprisingly this is a native event
// in modern browsers, and falls back to an icky polling function
// in MSIE. But it looks like there's a bug. The polling function
// should get installed when the app is started. But it's guarded
// behind if (Sammy.HashLocationProxy._interval != null). And of
// course that's not specific to the application; it's pretty
// global. So we need to manually clear that in order for links to
// work in MSIE.
// Filed as https://github.com/quirkey/sammy/issues/171
//
// Note for when we upgrade: HashLocationProxy has become
// DefaultLocationProxy in later versions, but otherwise the issue
// remains.
2016-02-17 13:31:29 +08:00
2016-01-28 06:00:09 +08:00
// updated to the version 0.7.6 this _interval = null is fixed
// just leave the history here.
//Sammy.HashLocationProxy._interval = null;
2022-05-26 22:49:07 +08:00
var url = this.location.toString();
var hash = this.location.hash;
var pathname = this.location.pathname;
if (url.indexOf('#') == -1) {
this.location = url + '#/';
} else if (hash.indexOf('#token_type') != - 1 && pathname == '/') {
// This is equivalent to previous `if` clause when uaa authorisation is used.
// Tokens are passed in the url hash, so the url always contains a #.
// We need to check the current path is `/` and token is present,
// so we can redirect to `/#/`
this.location = url.replace(/#token_type.+/gi, '#/');
}
2022-05-26 22:49:07 +08:00
app = new Sammy.Application(dispatcher);
app.run();
}
2010-10-08 00:23:11 +08:00
function setup_constant_events() {
$('#update-every').on('change', function() {
2010-10-08 00:23:11 +08:00
var interval = $(this).val();
2011-01-18 02:06:02 +08:00
store_pref('interval', interval);
if (interval == '')
interval = null;
else
interval = parseInt(interval);
2010-10-08 00:23:11 +08:00
set_timer_interval(interval);
});
$('#show-vhost').on('change', function() {
2010-10-08 00:23:11 +08:00
current_vhost = $(this).val();
2011-01-18 01:23:54 +08:00
store_pref('vhost', current_vhost);
2010-10-08 00:23:11 +08:00
update();
});
if (!vhosts_interesting) {
$('#vhost-form').hide();
}
2010-10-08 00:23:11 +08:00
}
function update_vhosts() {
var vhosts = JSON.parse(sync_get('/vhosts'));
vhosts_interesting = vhosts.length > 1;
if (vhosts_interesting)
$('#vhost-form').show();
else
$('#vhost-form').hide();
2010-10-08 00:23:11 +08:00
var select = $('#show-vhost').get(0);
select.options.length = vhosts.length + 1;
var index = 0;
for (var i = 0; i < vhosts.length; i++) {
var vhost = vhosts[i].name;
2011-01-18 21:32:47 +08:00
select.options[i + 1] = new Option(vhost, vhost);
2010-10-08 00:23:11 +08:00
if (vhost == current_vhost) index = i + 1;
}
select.selectedIndex = index;
2011-01-18 21:32:47 +08:00
current_vhost = select.options[index].value;
store_pref('vhost', current_vhost);
2010-10-08 00:23:11 +08:00
}
function setup_extensions() {
var extensions = JSON.parse(sync_get('/extensions'));
extension_count = 0;
for (var i in extensions) {
var extension = extensions[i];
if ($.isPlainObject(extension) && extension.hasOwnProperty('javascript')) {
dynamic_load(extension.javascript);
extension_count++;
}
}
}
function dynamic_load(filename) {
var element = document.createElement('script');
element.setAttribute('type', 'text/javascript');
element.setAttribute('src', 'js/' + filename);
document.getElementsByTagName('head')[0].appendChild(element);
}
2011-01-18 02:06:02 +08:00
function update_interval() {
var intervalStr = get_pref('interval');
var interval;
if (intervalStr == null) interval = 5000;
else if (intervalStr == '') interval = null;
else interval = parseInt(intervalStr);
if (isNaN(interval)) interval = null; // Prevent DoS if cookie malformed
2011-01-18 02:06:02 +08:00
set_timer_interval(interval);
var select = $('#update-every').get(0);
var opts = select.options;
for (var i = 0; i < opts.length; i++) {
if (opts[i].value == intervalStr) {
2011-01-18 02:06:02 +08:00
select.selectedIndex = i;
break;
}
}
2010-10-08 00:23:11 +08:00
}
function go_to(url) {
this.location = url;
}
function set_timer_interval(interval) {
timer_interval = interval;
reset_timer();
}
function reset_timer() {
clearInterval(timer);
if (timer_interval != null) {
timer = setInterval(partial_update, timer_interval);
}
}
function update_manual(div, query) {
var path;
var template;
2014-10-03 00:09:06 +08:00
if (query == 'memory' || query == 'binary') {
path = current_reqs['node']['path'] + '?' + query + '=true';
template = query;
}
var data = JSON.parse(sync_get(path));
replace_content(div, format(template, data));
2012-10-09 23:33:44 +08:00
postprocess_partial();
}
function render(reqs, template, highlight) {
var old_template = current_template;
current_template = template;
current_reqs = reqs;
for (var i in outstanding_reqs) {
outstanding_reqs[i].abort();
}
outstanding_reqs = [];
current_highlight = highlight;
2018-07-20 22:04:58 +08:00
if (old_template !== current_template) {
window.scrollTo(0, 0);
}
2010-09-29 23:56:03 +08:00
update();
}
2010-09-29 23:56:03 +08:00
function update() {
2012-12-07 19:35:40 +08:00
replace_content('debug', '');
clearInterval(timer);
2010-10-08 00:23:11 +08:00
with_update(function(html) {
update_navigation();
replace_content('main', html);
postprocess();
2010-10-12 00:05:06 +08:00
postprocess_partial();
render_charts();
maybe_scroll();
reset_timer();
});
2010-07-13 20:03:36 +08:00
}
2010-09-29 23:56:03 +08:00
function partial_update() {
2015-10-13 21:53:20 +08:00
if (!$(".pagination_class").is(":focus")) {
if ($('.updatable').length > 0) {
if (update_counter >= 200) {
update_counter = 0;
full_refresh();
return;
}
2015-10-13 21:53:20 +08:00
with_update(function(html) {
update_counter++;
replace_content('scratch', html);
var befores = $('#main .updatable');
var afters = $('#scratch .updatable');
if (befores.length != afters.length) {
console.log("before/after mismatch! Doing a full reload...");
full_refresh();
2015-10-13 21:53:20 +08:00
}
for (var i = 0; i < befores.length; i++) {
$(befores[i]).empty().append($(afters[i]).contents());
}
replace_content('scratch', '');
postprocess_partial();
render_charts();
});
}
}
}
function update_navigation() {
var l1 = '';
var l2 = '';
var descend = null;
for (var k in NAVIGATION) {
var val = NAVIGATION[k];
var path = val;
while (!leaf(path)) {
path = first_showable_child(path);
}
var selected = false;
if (contains_current_highlight(val)) {
selected = true;
if (!leaf(val)) {
descend = nav(val);
}
}
if (show(path)) {
l1 += '<li><a href="' + nav(path) + '"' +
(selected ? ' class="selected"' : '') + '>' + k + '</a></li>';
}
}
if (descend) {
l2 = obj_to_ul(descend);
$('#main').addClass('with-rhs');
}
else {
$('#main').removeClass('with-rhs');
}
replace_content('tabs', l1);
replace_content('rhs', l2);
}
function nav(pair) {
return pair[0];
}
function show(pair) {
return jQuery.inArray(pair[1], user_tags) != -1;
}
function leaf(pair) {
return typeof(nav(pair)) == 'string';
}
function first_showable_child(pair) {
var items = pair[0];
var ks = keys(items);
for (var i = 0; i < ks.length; i++) {
var child = items[ks[i]];
if (show(child)) return child;
}
return items[ks[0]]; // We'll end up not showing it anyway
}
function contains_current_highlight(val) {
if (leaf(val)) {
return current_highlight == nav(val);
}
else {
var b = false;
for (var k in val) {
b |= contains_current_highlight(val[k]);
}
return b;
}
}
function obj_to_ul(val) {
var res = '<ul>';
for (var k in val) {
var obj = val[k];
if (show(obj)) {
res += '<li>';
if (leaf(obj)) {
res += '<a href="' + nav(obj) + '"' +
(current_highlight == nav(obj) ? ' class="selected"' : '') +
'>' + k + '</a>';
}
else {
res += obj_to_ul(nav(obj));
}
res += '</li>';
}
}
return res + '</ul>';
}
function full_refresh() {
store_pref('position', x_position() + ',' + y_position());
location.reload();
}
function maybe_scroll() {
var pos = get_pref('position');
if (pos) {
clear_pref('position');
var xy = pos.split(",");
window.scrollTo(parseInt(xy[0]), parseInt(xy[1]));
}
}
function x_position() {
return window.pageXOffset ?
window.pageXOffset :
document.documentElement.scrollLeft ?
document.documentElement.scrollLeft :
document.body.scrollLeft;
}
function y_position() {
return window.pageYOffset ?
window.pageYOffset :
document.documentElement.scrollTop ?
document.documentElement.scrollTop :
document.body.scrollTop;
}
2010-10-08 00:23:11 +08:00
function with_update(fun) {
if(outstanding_reqs.length > 0){
return false;
}
var model = [];
model['extra_content'] = []; // magic key for extension point
with_reqs(apply_state(current_reqs), model, function(json) {
var html = format(current_template, json);
fun(html);
update_status('ok');
});
return true;
}
2010-10-12 00:05:06 +08:00
function apply_state(reqs) {
var reqs2 = {};
for (k in reqs) {
var req = reqs[k];
var options = {};
if (typeof(req) == "object") {
options = req.options;
req = req.path;
}
2010-10-12 00:05:06 +08:00
var req2;
if (options['vhost'] != undefined && current_vhost != '') {
2015-10-22 18:46:52 +08:00
var indexPage = req.indexOf("?page=");
if (indexPage >- 1) {
2015-10-13 21:53:20 +08:00
pageUrl = req.substr(indexPage);
2015-10-22 20:35:37 +08:00
req2 = req.substr(0,indexPage) + '/' + esc(current_vhost) + pageUrl;
2015-10-13 21:53:20 +08:00
} else
req2 = req + '/' + esc(current_vhost);
2010-10-12 00:05:06 +08:00
}
else {
req2 = req;
2010-10-08 00:23:11 +08:00
}
2012-12-20 01:58:36 +08:00
var qs = [];
if (options['sort'] != undefined && current_sort != null) {
2012-12-20 01:58:36 +08:00
qs.push('sort=' + current_sort);
qs.push('sort_reverse=' + current_sort_reverse);
2010-10-12 00:05:06 +08:00
}
if (options['ranges'] != undefined) {
for (i in options['ranges']) {
var type = options['ranges'][i];
var range = get_pref('chart-range').split('|');
var prefix;
if (type.substring(0, 8) == 'lengths-') {
prefix = 'lengths';
}
else if (type.substring(0, 10) == 'msg-rates-') {
prefix = 'msg_rates';
}
else if (type.substring(0, 11) == 'data-rates-') {
prefix = 'data_rates';
}
else if (type == 'node-stats') {
prefix = 'node_stats';
}
qs.push(prefix + '_age=' + parseInt(range[0]));
qs.push(prefix + '_incr=' + parseInt(range[1]));
}
2010-10-12 00:05:06 +08:00
}
/* Unknown options are used as query parameters as is. */
Object.keys(options).forEach(function (key) {
/* Skip known keys we already handled and undefined parameters. */
if (key == 'vhost' || key == 'sort' || key == 'ranges')
return;
if (!key || options[key] == undefined)
return;
qs.push(esc(key) + '=' + esc(options[key]));
});
2012-12-20 01:58:36 +08:00
qs = qs.join('&');
if (qs != '')
if (req2.indexOf("?page=") >- 1)
2015-10-22 15:55:36 +08:00
qs = '&' + qs;
else
qs = '?' + qs;
2010-10-12 00:05:06 +08:00
reqs2[k] = req2 + qs;
2010-10-08 00:23:11 +08:00
}
2010-10-12 00:05:06 +08:00
return reqs2;
2010-10-08 00:23:11 +08:00
}
function show_popup(type, text, _mode) {
var cssClass = '.form-popup-' + type;
function hide() {
$(cssClass).fadeOut(100, function() {
$(this).remove();
});
}
hide();
$('#outer').after(format('popup', {'type': type, 'text': text}));
$(cssClass).fadeIn(100);
$(cssClass + ' span').on('click', function () {
$('.popup-owner').removeClass('popup-owner');
hide();
});
}
function hide_popup_warn() {
var cssClass = '.form-popup-warn';
$('.popup-owner').removeClass('popup-owner');
$(cssClass).fadeOut(100, function() {
$(this).remove();
});
}
function submit_import(form) {
if (form.file.value) {
var confirm_upload = confirm('Are you sure you want to import a definitions file? Some entities (vhosts, users, queues, etc) may be overwritten!');
2017-05-18 22:22:50 +08:00
if (confirm_upload === true) {
var file = form.file.files[0]; // FUTURE: limit upload file size (?)
var vhost_upload = $("select[name='vhost-upload'] option:selected");
var vhost_selected = vhost_upload.index() > 0;
var vhost_name = null;
if (vhost_selected) {
vhost_name = vhost_upload.val();
}
var vhost_part = '';
if (vhost_name) {
vhost_part = '/' + esc(vhost_name);
}
var form_action = "/definitions" + vhost_part;
var fd = new FormData();
fd.append('file', file);
with_req('POST', form_action, fd, function(resp) {
show_popup('info', 'Your definitions were imported successfully.');
});
}
}
return false;
};
2016-02-16 18:50:03 +08:00
function postprocess() {
$('form.confirm-queue').on('submit', function() {
return confirm("Are you sure? The queue is going to be deleted. " +
"Messages cannot be recovered after deletion.");
});
$('form.confirm-purge-queue').on('submit', function() {
return confirm("Are you sure? Messages cannot be recovered after purging.");
});
$('form.confirm').on('submit', function() {
2010-08-24 17:24:50 +08:00
return confirm("Are you sure? This object cannot be recovered " +
"after deletion.");
});
$('label').map(function() {
if ($(this).attr('for') == '') {
var id = 'auto-label-' + Math.floor(Math.random()*1000000000);
var input = $(this).parents('tr').first().find('input, select');
if (input.attr('id') == '') {
$(this).attr('for', id);
input.attr('id', id);
}
}
});
$('#download-definitions').on('click', function() {
// https://stackoverflow.com/questions/16086162/handle-file-download-from-ajax-post/23797348
// https://gist.github.com/zynick/12bae6dbc76f6aacedf0/
var idx = $("select[name='vhost-download'] option:selected").index();
var vhost = ((idx <=0 ) ? "" : "/" + esc($("select[name='vhost-download'] option:selected").val()));
var download_filename = esc($('#download-filename').val());
var path = 'api/definitions' + vhost + '?download=' + download_filename;
var req = xmlHttpRequest();
req.open('GET', path, true);
req.setRequestHeader('authorization', auth_header());
req.responseType = 'blob';
req.onload = function (_event) {
if (this.status >= 200 && this.status <= 299) {
var type = req.getResponseHeader('Content-Type');
var blob = new Blob([this.response], { type: type });
if (typeof window.navigator.msSaveBlob !== 'undefined') {
window.navigator.msSaveBlob(blob, download_filename);
} else {
var URL = window.URL || window.webkitURL;
var downloadUrl = URL.createObjectURL(blob);
var a = document.createElement("a");
if (typeof a.download === 'undefined') {
window.location = downloadUrl;
} else {
a.href = downloadUrl;
a.download = download_filename;
document.body.appendChild(a);
a.click();
}
var cleanup = function () {
URL.revokeObjectURL(downloadUrl);
document.body.removeChild(a);
};
setTimeout(cleanup, 1000);
}
} else {
// Unsuccessful status
show_popup('warn', 'Error downloading definitions');
}
};
req.send();
});
2016-02-16 18:50:03 +08:00
$('.update-manual').on('click', function() {
update_manual($(this).attr('for'), $(this).attr('query'));
});
$(document).on('keyup', '.multifield input', function() {
update_multifields();
});
$(document).on('change', '.multifield select', function() {
2010-10-12 21:08:17 +08:00
update_multifields();
});
$('.controls-appearance').on('change', function() {
var params = $(this).get(0).options;
var selected = $(this).val();
for (i = 0; i < params.length; i++) {
var param = params[i].value;
if (param == selected) {
$('#' + param + '-div').slideDown(100);
} else {
$('#' + param + '-div').slideUp(100);
}
2010-12-09 01:40:10 +08:00
}
});
$(document).on('click', '.help', function() {
show_popup('help', HELP[$(this).attr('id')]);
});
$(document).on('click', '.popup-options-link', function() {
$('.popup-owner').removeClass('popup-owner');
$(this).addClass('popup-owner');
var template = $(this).attr('type') + '-options';
show_popup('options', format(template, {span: $(this)}), 'fade');
});
$(document).on('click', '.rate-visibility-option', function() {
2014-06-05 00:44:19 +08:00
var k = $(this).attr('data-pref');
var show = get_pref(k) !== 'true';
store_pref(k, '' + show);
partial_update();
});
$(document).on('focus', 'input, select', function() {
update_counter = 0; // If there's interaction, reset the counter.
});
$('.tag-link').on('click', function() {
$('#tags').val($(this).attr('tag'));
});
$('.argument-link').on('click', function() {
var field = $(this).attr('field');
var row = $('#' + field).find('.mf').last();
var key = row.find('input').first();
var value = row.find('input').last();
var type = row.find('select').last();
key.val($(this).attr('key'));
value.val($(this).attr('value'));
type.val($(this).attr('type'));
update_multifields();
});
$(document).on('click', 'form.auto-submit select, form.auto-submit input', function(){
$(this).parents('form').submit();
});
$('#filter').on('keyup', debounce(update_filter, 500));
$('#filter-regex-mode').on('change', update_filter_regex_mode);
$('#truncate').on('keyup', debounce(update_truncate, 500));
if (! user_administrator) {
$('.administrator-only').remove();
}
2010-10-12 21:08:17 +08:00
update_multifields();
}
2020-11-19 21:48:25 +08:00
function url_pagination_template_context(template, context, defaultPage, defaultPageSize){
var page_number_request = fmt_page_number_request(context, defaultPage);
var page_size = fmt_page_size_request(context, defaultPageSize);
var name_request = fmt_filter_name_request(context, "");
var use_regex = fmt_regex_request(context, "") == "checked";
if (use_regex) {
name_request = esc(name_request);
}
return '/' + template +
'?page=' + page_number_request +
'&page_size=' + page_size +
'&name=' + name_request +
'&use_regex=' + use_regex;
2015-10-15 18:44:36 +08:00
}
2020-11-19 21:48:25 +08:00
function url_pagination_template(template, defaultPage, defaultPageSize){
return url_pagination_template_context(template, template, defaultPage, defaultPageSize);
}
2015-11-17 23:59:49 +08:00
function stored_page_info(template, page_start){
var pageSize = fmt_strip_tags($('#' + template+'-pagesize').val());
var filterName = fmt_strip_tags($('#' + template+'-name').val());
2016-01-26 06:51:53 +08:00
2015-11-17 23:59:49 +08:00
store_pref(template + '_current_page_number', page_start);
2015-11-13 05:25:01 +08:00
if (filterName != null && filterName != undefined) {
2015-11-17 23:59:49 +08:00
store_pref(template + '_current_filter_name', filterName);
2015-11-13 05:25:01 +08:00
}
2015-11-17 23:59:49 +08:00
var regex_on = $("#" + template + "-filter-regex-mode").is(':checked');
if (regex_on != null && regex_on != undefined) {
store_pref(template + '_current_regex', regex_on ? "checked" : " " );
}
2015-10-22 18:46:52 +08:00
if (pageSize != null && pageSize != undefined) {
2015-11-17 23:59:49 +08:00
store_pref(template + '_current_page_size', pageSize);
}
2015-10-13 21:53:20 +08:00
}
2015-11-17 23:59:49 +08:00
function update_pages(template, page_start){
2015-11-18 00:31:55 +08:00
stored_page_info(template, page_start);
2015-11-17 23:59:49 +08:00
switch (template) {
case 'queues' : renderQueues(); break;
case 'exchanges' : renderExchanges(); break;
2015-11-20 16:57:22 +08:00
case 'connections' : renderConnections(); break;
2015-11-17 23:59:49 +08:00
case 'channels' : renderChannels(); break;
2020-11-19 21:48:25 +08:00
default:
renderCallback = RENDER_CALLBACKS[template];
if (renderCallback != undefined) {
renderCallback();
}
break;
2015-11-17 23:59:49 +08:00
}
}
2015-10-13 21:53:20 +08:00
2015-11-17 23:59:49 +08:00
function renderQueues() {
ensure_queues_chart_range();
render({'queues': {
path: url_pagination_template('queues', 1, 100),
options: {
sort: true,
vhost: true,
pagination: true
}
}, 'vhosts': '/vhosts'}, 'queues', '#/queues');
2015-11-17 23:59:49 +08:00
}
function renderExchanges() {
render({'exchanges': {path: url_pagination_template('exchanges', 1, 100),
2015-11-17 23:59:49 +08:00
options: {sort:true, vhost:true, pagination:true}},
'vhosts': '/vhosts'}, 'exchanges', '#/exchanges');
}
function renderConnections() {
2016-01-26 06:51:53 +08:00
render({'connections': {path: url_pagination_template('connections', 1, 100),
2015-11-17 23:59:49 +08:00
options: {sort:true}}},
'connections', '#/connections');
}
function renderChannels() {
2016-01-26 06:51:53 +08:00
render({'channels': {path: url_pagination_template('channels', 1, 100),
2015-11-17 23:59:49 +08:00
options: {sort:true}}},
'channels', '#/channels');
}
2016-01-24 18:28:51 +08:00
function update_pages_from_ui(sender) {
var val = $(sender).val();
var raw = !!$(sender).attr('data-page-start') ? $(sender).attr('data-page-start') : val;
var s = fmt_escape_html(fmt_strip_tags(raw));
update_pages(current_template, s);
2016-01-24 18:28:51 +08:00
}
2015-11-17 23:59:49 +08:00
function postprocess_partial() {
$('.pagination_class_input').on('keypress', function(e) {
2016-01-24 18:28:51 +08:00
if (e.keyCode == 13) {
update_pages_from_ui(this);
}
});
$('.pagination_class_checkbox').on('click', function(e) {
2016-01-24 18:28:51 +08:00
update_pages_from_ui(this);
});
$('.pagination_class_select').on('change', function(e) {
2016-01-24 18:28:51 +08:00
update_pages_from_ui(this);
2015-11-13 05:25:01 +08:00
});
setup_visibility();
$('#main').off('click', 'div.section h2, div.section-hidden h2');
$('#main').on('click', 'div.section h2, div.section-hidden h2', function() {
toggle_visibility($(this));
});
$('.sort').on('click', function() {
2010-10-12 00:05:06 +08:00
var sort = $(this).attr('sort');
if (current_sort == sort) {
current_sort_reverse = ! current_sort_reverse;
}
else {
current_sort = sort;
current_sort_reverse = false;
}
update();
});
// TODO remove this hack when we get rid of "updatable"
if ($('#filter-warning-show').length > 0) {
$('#filter-truncate').addClass('filter-warning');
}
else {
$('#filter-truncate').removeClass('filter-warning');
}
2010-10-12 00:05:06 +08:00
}
2010-10-12 21:08:17 +08:00
function update_multifields() {
$('div.multifield').each(function(index) {
update_multifield($(this), true);
});
}
function update_multifield(multifield, dict) {
var largest_id = 0;
var empty_found = false;
var name = multifield.attr('id');
var type_inputs = $('#' + name + ' *[name$="_mftype"]');
type_inputs.each(function(index) {
var re = new RegExp(name + '_([0-9]*)_mftype');
var match = $(this).attr('name').match(re);
if (!match) return;
var id = parseInt(match[1]);
largest_id = Math.max(id, largest_id);
var prefix = name + '_' + id;
var type = $(this).val();
var input = $('#' + prefix + '_mfvalue');
if (type == 'list') {
if (input.length == 1) {
input.replaceWith('<div class="multifield-sub" id="' + prefix +
'"></div>');
}
update_multifield($('#' + prefix), false);
}
else {
if (input.length == 1) {
var key = dict ? $('#' + prefix + '_mfkey').val() : '';
var value = input.val();
if (key == '' && value == '') {
if (index == type_inputs.length - 1) {
empty_found = true;
}
else {
$(this).parents('.mf').first().remove();
2010-10-12 21:08:17 +08:00
}
}
2010-10-12 21:08:17 +08:00
}
else {
$('#' + prefix).replaceWith(multifield_input(prefix, 'value',
'text'));
}
}
});
if (!empty_found) {
var prefix = name + '_' + (largest_id + 1);
var t = multifield.hasClass('string-only') ? 'hidden' : 'select';
var val_type = multifield_input(prefix, 'value', 'text') + ' ' +
multifield_input(prefix, 'type', t);
if (dict) {
multifield.append('<table class="mf"><tr><td>' +
multifield_input(prefix, 'key', 'text') +
'</td><td class="equals"> = </td><td>' +
val_type + '</td></tr></table>');
}
else {
multifield.append('<div class="mf">' + val_type + '</div>');
}
}
}
function multifield_input(prefix, suffix, type) {
if (type == 'hidden' ) {
return '<input type="hidden" id="' + prefix + '_mf' + suffix +
'" name="' + prefix + '_mf' + suffix + '" value="string"/>';
}
else if (type == 'text' ) {
return '<input type="text" id="' + prefix + '_mf' + suffix +
'" name="' + prefix + '_mf' + suffix + '" value=""/>';
}
else if (type == 'select' ) {
return '<select id="' + prefix + '_mf' + suffix + '" name="' + prefix +
'_mf' + suffix + '">' +
'<option value="string">String</option>' +
'<option value="number">Number</option>' +
'<option value="boolean">Boolean</option>' +
'<option value="list">List</option>' +
'</select>';
}
2010-10-12 21:08:17 +08:00
}
function update_filter_regex(jElem) {
2013-11-13 00:41:31 +08:00
current_filter_regex = null;
jElem.parents('.filter').children('.status-error').remove();
if (current_filter_regex_on && $.trim(current_filter).length > 0) {
2013-11-13 00:41:31 +08:00
try {
current_filter_regex = new RegExp(current_filter,'i');
} catch (e) {
jElem.parents('.filter').append('<p class="status-error">' +
fmt_escape_html(e.message) + '</p>');
}
2013-11-13 00:41:31 +08:00
}
}
function update_filter_regex_mode() {
current_filter_regex_on = $(this).is(':checked');
update_filter_regex($(this));
2013-11-13 00:41:31 +08:00
partial_update();
}
2013-04-08 21:00:06 +08:00
function update_filter() {
current_filter = $(this).val();
var table = $(this).parents('table').first();
table.removeClass('filter-active');
if ($(this).val() != '') {
table.addClass('filter-active');
}
update_filter_regex($(this));
partial_update();
2013-04-25 23:13:44 +08:00
}
function update_truncate() {
var current_truncate_str =
$(this).val().replace(new RegExp('\\D', 'g'), '');
if (current_truncate_str == '') {
current_truncate_str = '0';
}
if ($(this).val() != current_truncate_str) {
$(this).val(current_truncate_str);
}
var current_truncate = parseInt(current_truncate_str, 10);
2013-04-25 23:13:44 +08:00
store_pref('truncate', current_truncate);
2013-04-08 21:00:06 +08:00
partial_update();
}
function setup_visibility() {
$('div.section,div.section-hidden').each(function(_index) {
var pref = section_pref(current_template,
$(this).children('h2').text());
var show = get_pref(pref);
if (show == null) {
show = $(this).hasClass('section');
}
else {
show = show == 't';
}
if (show) {
$(this).addClass('section-visible');
// Workaround for... something. Although div.hider is
// display:block anyway, not explicitly setting this
// prevents the first slideToggle() from animating
// successfully; instead the element just vanishes.
$(this).find('.hider').attr('style', 'display:block;');
}
else {
$(this).addClass('section-invisible');
}
});
}
function toggle_visibility(item) {
var hider = item.next();
var all = item.parent();
var pref = section_pref(current_template, item.text());
item.next().slideToggle(100);
if (all.hasClass('section-visible')) {
if (all.hasClass('section'))
store_pref(pref, 'f');
else
clear_pref(pref);
all.removeClass('section-visible');
all.addClass('section-invisible');
}
else {
if (all.hasClass('section-hidden')) {
store_pref(pref, 't');
} else {
clear_pref(pref);
}
all.removeClass('section-invisible');
all.addClass('section-visible');
}
}
function publish_msg(params0) {
try {
var params = params_magic(params0);
publish_msg0(params);
} catch (e) {
show_popup('warn', fmt_escape_html(e));
return false;
}
}
function publish_msg0(params) {
2011-02-24 01:59:34 +08:00
var path = fill_path_template('/exchanges/:vhost/:name/publish', params);
params['properties'] = {};
2011-02-25 22:27:09 +08:00
params['properties']['delivery_mode'] = parseInt(params['delivery_mode']);
if (params['headers'] != '')
params['properties']['headers'] = params['headers'];
var props = [['content_type', 'str'],
['content_encoding', 'str'],
['correlation_id', 'str'],
['reply_to', 'str'],
['expiration', 'str'],
['message_id', 'str'],
['type', 'str'],
['user_id', 'str'],
['app_id', 'str'],
['cluster_id', 'str'],
['priority', 'int'],
['timestamp', 'int']];
for (var i in props) {
var name = props[i][0];
var type = props[i][1];
if (params['props'][name] != undefined && params['props'][name] != '') {
var value = params['props'][name];
if (type == 'int') value = parseInt(value);
params['properties'][name] = value;
}
}
2011-02-24 01:59:34 +08:00
with_req('POST', path, JSON.stringify(params), function(resp) {
var result = JSON.parse(resp.responseText);
2011-02-24 01:59:34 +08:00
if (result.routed) {
show_popup('info', 'Message published.');
} else {
show_popup('warn', 'Message published, but not routed.');
}
});
}
function get_msgs(params) {
var path = fill_path_template('/queues/:vhost/:name/get', params);
with_req('POST', path, JSON.stringify(params), function(resp) {
var msgs = JSON.parse(resp.responseText);
if (msgs.length == 0) {
show_popup('info', 'Queue is empty');
} else {
$('#msg-wrapper').slideUp(200);
replace_content('msg-wrapper', format('messages', {'msgs': msgs}));
$('#msg-wrapper').slideDown(200);
}
});
}
function with_reqs(reqs, acc, fun) {
if (keys(reqs).length > 0) {
var key = keys(reqs)[0];
with_req('GET', reqs[key], null, function(resp) {
if (key.startsWith("extra_")) {
var extraContent = acc["extra_content"];
extraContent[key] = JSON.parse(resp.responseText);
acc["extra_content"] = extraContent;
} else {
acc[key] = JSON.parse(resp.responseText);
}
var remainder = {};
for (var k in reqs) {
if (k != key) remainder[k] = reqs[k];
}
with_reqs(remainder, acc, fun);
});
}
else {
fun(acc);
}
}
2010-07-13 00:31:16 +08:00
function replace_content(id, html) {
2011-01-28 19:12:29 +08:00
$("#" + id).html(html);
2010-07-13 00:31:16 +08:00
}
var ejs_cached = {};
function format(template, json) {
2014-10-06 20:05:52 +08:00
try {
var cache = true;
if (!(template in ejs_cached)) {
ejs_cached[template] = true;
cache = false;
}
var tmpl = new EJS({url: 'js/tmpl/' + template + '.ejs', cache: cache});
return tmpl.render(json);
2014-10-06 20:05:52 +08:00
} catch (err) {
clearInterval(timer);
console.log("Uncaught error: " + err);
console.log("Stack: " + err['stack']);
debug(err['name'] + ": " + err['message'] + "\n" + err['stack'] + "\n");
2014-10-06 20:05:52 +08:00
}
}
function maybe_format_extra_queue_content(queue, extraContent) {
var content = '';
for (var i = 0; i < QUEUE_EXTRA_CONTENT.length; i++) {
content += QUEUE_EXTRA_CONTENT[i](queue, extraContent);
}
return content;
}
function update_status(status) {
2010-07-13 00:31:16 +08:00
var text;
if (status == 'ok')
text = "Refreshed " + fmt_date(new Date());
else if (status == 'error') {
var next_try = new Date(new Date().getTime() + timer_interval);
text = "Error: could not connect to server since " +
fmt_date(last_successful_connect) + ". Will retry at " +
2011-01-14 19:45:45 +08:00
fmt_date(next_try) + ".";
}
else
throw("Unknown status " + status);
2010-07-13 00:31:16 +08:00
var html = format('status', {status: status, text: text});
2010-07-13 00:31:16 +08:00
replace_content('status', html);
}
function with_req(method, path, body, fun) {
if(!has_auth_credentials()) {
// navigate to the login form
location.reload();
return;
}
var json;
var req = xmlHttpRequest();
2011-06-08 00:25:00 +08:00
req.open(method, 'api' + path, true );
var header = authorization_header();
if (header !== null) {
req.setRequestHeader('authorization', header);
}
req.setRequestHeader('x-vhost', current_vhost);
req.onreadystatechange = function () {
if (req.readyState == 4) {
var ix = jQuery.inArray(req, outstanding_reqs);
if (ix != -1) {
outstanding_reqs.splice(ix, 1);
}
2011-03-16 19:34:55 +08:00
if (check_bad_response(req, true)) {
last_successful_connect = new Date();
fun(req);
}
}
};
outstanding_reqs.push(req);
req.send(body);
}
2010-07-13 20:03:36 +08:00
function get(url, accept, callback) {
var req = new XMLHttpRequest();
req.open("GET", url);
req.setRequestHeader("Accept", accept);
req.send();
req.onreadystatechange = function() {
if (req.readyState == XMLHttpRequest.DONE) {
callback(req);
}
};
}
function sync_get(path) {
return sync_req('GET', [], path);
}
2010-08-25 01:46:30 +08:00
function sync_put(sammy, path_template) {
return sync_req('PUT', sammy.params, path_template);
2010-08-25 01:46:30 +08:00
}
function sync_delete(sammy, path_template, options) {
return sync_req('DELETE', sammy.params, path_template, options);
2010-08-25 01:46:30 +08:00
}
2010-09-02 00:26:51 +08:00
function sync_post(sammy, path_template) {
return sync_req('POST', sammy.params, path_template);
2010-09-02 00:26:51 +08:00
}
function sync_req(type, params0, path_template, options) {
2011-03-09 02:43:14 +08:00
var params;
var path;
try {
2011-03-09 02:43:14 +08:00
params = params_magic(params0);
path = fill_path_template(path_template, params);
} catch (e) {
show_popup('warn', fmt_escape_html(e));
return false;
}
var req = xmlHttpRequest();
2011-06-08 00:25:00 +08:00
req.open(type, 'api' + path, false);
req.setRequestHeader('content-type', 'application/json');
req.setRequestHeader('authorization', authorization_header());
if (options != undefined || options != null) {
if (options.headers != undefined || options.headers != null) {
jQuery.each(options.headers, function (k, v) {
req.setRequestHeader(k, v);
});
}
}
try {
if (type == 'GET')
req.send(null);
else
req.send(JSON.stringify(params));
}
catch (e) {
if (e.number == 0x80004004) {
// 0x80004004 means "Operation aborted."
URL Cleanup This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener). # HTTP URLs that Could Not Be Fixed These URLs were unable to be fixed. Please review them to see if they can be manually resolved. * http://blog.listincomprehension.com/search/label/procket (200) with 1 occurrences could not be migrated: ([https](https://blog.listincomprehension.com/search/label/procket) result ClosedChannelException). * http://dozzie.jarowit.net/trac/wiki/TOML (200) with 1 occurrences could not be migrated: ([https](https://dozzie.jarowit.net/trac/wiki/TOML) result SSLHandshakeException). * http://dozzie.jarowit.net/trac/wiki/subproc (200) with 1 occurrences could not be migrated: ([https](https://dozzie.jarowit.net/trac/wiki/subproc) result SSLHandshakeException). * http://e2project.org (200) with 1 occurrences could not be migrated: ([https](https://e2project.org) result AnnotatedConnectException). * http://erik.eae.net/archives/2007/07/27/18.54.15/ (200) with 1 occurrences could not be migrated: ([https](https://erik.eae.net/archives/2007/07/27/18.54.15/) result SSLHandshakeException). * http://javascript.nwbox.com/IEContentLoaded/ (200) with 1 occurrences could not be migrated: ([https](https://javascript.nwbox.com/IEContentLoaded/) result SSLHandshakeException). * http://nitrogenproject.com/ (200) with 2 occurrences could not be migrated: ([https](https://nitrogenproject.com/) result ConnectTimeoutException). * http://proper.softlab.ntua.gr (200) with 1 occurrences could not be migrated: ([https](https://proper.softlab.ntua.gr) result SSLHandshakeException). * http://sammyjs.org (200) with 2 occurrences could not be migrated: ([https](https://sammyjs.org) result SSLHandshakeException). * http://sammyjs.org/docs/plugins (200) with 2 occurrences could not be migrated: ([https](https://sammyjs.org/docs/plugins) result SSLHandshakeException). * http://sammyjs.org/docs/routes (200) with 2 occurrences could not be migrated: ([https](https://sammyjs.org/docs/routes) result SSLHandshakeException). * http://webfx.eae.net/dhtml/boxsizing/boxsizing.html (200) with 1 occurrences could not be migrated: ([https](https://webfx.eae.net/dhtml/boxsizing/boxsizing.html) result SSLHandshakeException). * http://yaws.hyber.org (200) with 1 occurrences could not be migrated: ([https](https://yaws.hyber.org) result AnnotatedConnectException). * http://choven.ca (503) with 1 occurrences could not be migrated: ([https](https://choven.ca) result ConnectTimeoutException). # Fixed URLs ## Fixed But Review Recommended These URLs were fixed, but the https status was not OK. However, the https status was the same as the http request or http redirected to an https URL, so they were migrated. Your review is recommended. * http://fixprotocol.org/ (301) with 1 occurrences migrated to: https://fixtrading.org ([https](https://fixprotocol.org/) result SSLHandshakeException). * http://jsperf.com/getall-vs-sizzle/2 (301) with 1 occurrences migrated to: https://jsperf.com/getall-vs-sizzle/2 ([https](https://jsperf.com/getall-vs-sizzle/2) result ReadTimeoutException). * http://erldb.org (UnknownHostException) with 1 occurrences migrated to: https://erldb.org ([https](https://erldb.org) result UnknownHostException). * http://some-host-that-does-not-exist:15672/ (UnknownHostException) with 1 occurrences migrated to: https://some-host-that-does-not-exist:15672/ ([https](https://some-host-that-does-not-exist:15672/) result UnknownHostException). * http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ (301) with 1 occurrences migrated to: https://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ ([https](https://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/) result 404). * http://www.JSON.org/js.html (404) with 1 occurrences migrated to: https://www.JSON.org/js.html ([https](https://www.JSON.org/js.html) result 404). ## Fixed Success These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended. * http://bugs.jquery.com/ticket/12359 with 1 occurrences migrated to: https://bugs.jquery.com/ticket/12359 ([https](https://bugs.jquery.com/ticket/12359) result 200). * http://bugs.jquery.com/ticket/13378 with 1 occurrences migrated to: https://bugs.jquery.com/ticket/13378 ([https](https://bugs.jquery.com/ticket/13378) result 200). * http://cloudi.org/ with 27 occurrences migrated to: https://cloudi.org/ ([https](https://cloudi.org/) result 200). * http://code.quirkey.com/sammy/ with 1 occurrences migrated to: https://code.quirkey.com/sammy/ ([https](https://code.quirkey.com/sammy/) result 200). * http://erlware.org/ with 1 occurrences migrated to: https://erlware.org/ ([https](https://erlware.org/) result 200). * http://inaka.github.io/cowboy-trails/ with 1 occurrences migrated to: https://inaka.github.io/cowboy-trails/ ([https](https://inaka.github.io/cowboy-trails/) result 200). * http://jquery.com/ with 3 occurrences migrated to: https://jquery.com/ ([https](https://jquery.com/) result 200). * http://jsperf.com/thor-indexof-vs-for/5 with 1 occurrences migrated to: https://jsperf.com/thor-indexof-vs-for/5 ([https](https://jsperf.com/thor-indexof-vs-for/5) result 200). * http://ninenines.eu with 6 occurrences migrated to: https://ninenines.eu ([https](https://ninenines.eu) result 200). * http://ninenines.eu/ with 1 occurrences migrated to: https://ninenines.eu/ ([https](https://ninenines.eu/) result 200). * http://sizzlejs.com/ with 2 occurrences migrated to: https://sizzlejs.com/ ([https](https://sizzlejs.com/) result 200). * http://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/ with 1 occurrences migrated to: https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/ ([https](https://web.archive.org/web/20100324014747/https://blindsignals.com/index.php/2009/07/jquery-delay/) result 200). * http://www.actordb.com/ with 2 occurrences migrated to: https://www.actordb.com/ ([https](https://www.actordb.com/) result 200). * http://www.cs.kent.ac.uk/projects/wrangler/Home.html with 1 occurrences migrated to: https://www.cs.kent.ac.uk/projects/wrangler/Home.html ([https](https://www.cs.kent.ac.uk/projects/wrangler/Home.html) result 200). * http://www.enhanceie.com/ie/bugs.asp with 1 occurrences migrated to: https://www.enhanceie.com/ie/bugs.asp ([https](https://www.enhanceie.com/ie/bugs.asp) result 200). * http://www.rabbitmq.com/amqp-0-9-1-reference.html with 1 occurrences migrated to: https://www.rabbitmq.com/amqp-0-9-1-reference.html ([https](https://www.rabbitmq.com/amqp-0-9-1-reference.html) result 200). * http://www.rabbitmq.com/configure.html with 1 occurrences migrated to: https://www.rabbitmq.com/configure.html ([https](https://www.rabbitmq.com/configure.html) result 200). * http://www.rabbitmq.com/confirms.html with 1 occurrences migrated to: https://www.rabbitmq.com/confirms.html ([https](https://www.rabbitmq.com/confirms.html) result 200). * http://www.rabbitmq.com/consumers.html with 1 occurrences migrated to: https://www.rabbitmq.com/consumers.html ([https](https://www.rabbitmq.com/consumers.html) result 200). * http://www.rabbitmq.com/github.html with 1 occurrences migrated to: https://www.rabbitmq.com/github.html ([https](https://www.rabbitmq.com/github.html) result 200). * http://www.rabbitmq.com/ha.html with 3 occurrences migrated to: https://www.rabbitmq.com/ha.html ([https](https://www.rabbitmq.com/ha.html) result 200). * http://www.rabbitmq.com/management-cli.html with 1 occurrences migrated to: https://www.rabbitmq.com/management-cli.html ([https](https://www.rabbitmq.com/management-cli.html) result 200). * http://www.rabbitmq.com/management.html with 7 occurrences migrated to: https://www.rabbitmq.com/management.html ([https](https://www.rabbitmq.com/management.html) result 200). * http://www.rabbitmq.com/memory-use.html with 3 occurrences migrated to: https://www.rabbitmq.com/memory-use.html ([https](https://www.rabbitmq.com/memory-use.html) result 200). * http://www.rabbitmq.com/memory.html with 3 occurrences migrated to: https://www.rabbitmq.com/memory.html ([https](https://www.rabbitmq.com/memory.html) result 200). * http://www.rabbitmq.com/nettick.html with 1 occurrences migrated to: https://www.rabbitmq.com/nettick.html ([https](https://www.rabbitmq.com/nettick.html) result 200). * http://www.rabbitmq.com/partitions.html with 2 occurrences migrated to: https://www.rabbitmq.com/partitions.html ([https](https://www.rabbitmq.com/partitions.html) result 200). * http://www.rabbitmq.com/persistence-conf.html with 2 occurrences migrated to: https://www.rabbitmq.com/persistence-conf.html ([https](https://www.rabbitmq.com/persistence-conf.html) result 200). * http://www.rabbitmq.com/services.html with 1 occurrences migrated to: https://www.rabbitmq.com/services.html ([https](https://www.rabbitmq.com/services.html) result 200). * http://www.rebar3.org with 1 occurrences migrated to: https://www.rebar3.org ([https](https://www.rebar3.org) result 200). * http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html with 1 occurrences migrated to: https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html ([https](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html) result 200). * http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html with 1 occurrences migrated to: https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html ([https](https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html) result 200). * http://www.w3.org/TR/2011/REC-css3-selectors-20110929/ with 2 occurrences migrated to: https://www.w3.org/TR/2011/REC-css3-selectors-20110929/ ([https](https://www.w3.org/TR/2011/REC-css3-selectors-20110929/) result 200). * http://www.w3.org/TR/CSS21/syndata.html with 2 occurrences migrated to: https://www.w3.org/TR/CSS21/syndata.html ([https](https://www.w3.org/TR/CSS21/syndata.html) result 200). * http://www.w3.org/TR/DOM-Level-3-Events/ with 1 occurrences migrated to: https://www.w3.org/TR/DOM-Level-3-Events/ ([https](https://www.w3.org/TR/DOM-Level-3-Events/) result 200). * http://www.w3.org/TR/selectors/ with 4 occurrences migrated to: https://www.w3.org/TR/selectors/ ([https](https://www.w3.org/TR/selectors/) result 200). * http://code.google.com/p/stringencoders/ with 1 occurrences migrated to: https://code.google.com/p/stringencoders/ ([https](https://code.google.com/p/stringencoders/) result 301). * http://code.google.com/p/stringencoders/source/browse/ with 2 occurrences migrated to: https://code.google.com/p/stringencoders/source/browse/ ([https](https://code.google.com/p/stringencoders/source/browse/) result 301). * http://contributor-covenant.org with 1 occurrences migrated to: https://contributor-covenant.org ([https](https://contributor-covenant.org) result 301). * http://contributor-covenant.org/version/1/3/0/ with 1 occurrences migrated to: https://contributor-covenant.org/version/1/3/0/ ([https](https://contributor-covenant.org/version/1/3/0/) result 301). * http://dev.w3.org/csswg/cssom/ with 1 occurrences migrated to: https://dev.w3.org/csswg/cssom/ ([https](https://dev.w3.org/csswg/cssom/) result 301). * http://inaka.github.com/apns4erl with 1 occurrences migrated to: https://inaka.github.com/apns4erl ([https](https://inaka.github.com/apns4erl) result 301). * http://inaka.github.com/edis/ with 1 occurrences migrated to: https://inaka.github.com/edis/ ([https](https://inaka.github.com/edis/) result 301). * http://jquery.org/license with 2 occurrences migrated to: https://jquery.org/license ([https](https://jquery.org/license) result 301). * http://lasp-lang.org/ with 1 occurrences migrated to: https://lasp-lang.org/ ([https](https://lasp-lang.org/) result 301). * http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx with 1 occurrences migrated to: https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx ([https](https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx) result 301). * http://msdn.microsoft.com/en-us/library/ie/ms536648 with 1 occurrences migrated to: https://msdn.microsoft.com/en-us/library/ie/ms536648 ([https](https://msdn.microsoft.com/en-us/library/ie/ms536648) result 301). * http://rabbitmq.com with 5 occurrences migrated to: https://rabbitmq.com ([https](https://rabbitmq.com) result 301). * http://rabbitmq.com/ae.html with 1 occurrences migrated to: https://rabbitmq.com/ae.html ([https](https://rabbitmq.com/ae.html) result 301). * http://rabbitmq.com/consumers.html with 1 occurrences migrated to: https://rabbitmq.com/consumers.html ([https](https://rabbitmq.com/consumers.html) result 301). * http://rabbitmq.com/dlx.html with 2 occurrences migrated to: https://rabbitmq.com/dlx.html ([https](https://rabbitmq.com/dlx.html) result 301). * http://rabbitmq.com/maxlength.html with 2 occurrences migrated to: https://rabbitmq.com/maxlength.html ([https](https://rabbitmq.com/maxlength.html) result 301). * http://rabbitmq.com/passwords.html with 1 occurrences migrated to: https://rabbitmq.com/passwords.html ([https](https://rabbitmq.com/passwords.html) result 301). * http://rabbitmq.com/priority.html with 1 occurrences migrated to: https://rabbitmq.com/priority.html ([https](https://rabbitmq.com/priority.html) result 301). * http://rabbitmq.com/ttl.html with 2 occurrences migrated to: https://rabbitmq.com/ttl.html ([https](https://rabbitmq.com/ttl.html) result 301). * http://saleyn.github.com/erlexec with 1 occurrences migrated to: https://saleyn.github.com/erlexec ([https](https://saleyn.github.com/erlexec) result 301). * http://support.microsoft.com/kb/186063 with 1 occurrences migrated to: https://support.microsoft.com/kb/186063 ([https](https://support.microsoft.com/kb/186063) result 301). * http://technet.microsoft.com/en-us/sysinternals/bb896655 with 2 occurrences migrated to: https://technet.microsoft.com/en-us/sysinternals/bb896655 ([https](https://technet.microsoft.com/en-us/sysinternals/bb896655) result 301). * http://www.erlang.org/doc/man/sasl_app.html with 1 occurrences migrated to: https://www.erlang.org/doc/man/sasl_app.html ([https](https://www.erlang.org/doc/man/sasl_app.html) result 301). * http://www.mozilla.org/MPL/ with 86 occurrences migrated to: https://www.mozilla.org/MPL/ ([https](https://www.mozilla.org/MPL/) result 301). * http://www.mozilla.org/mpl/ with 3 occurrences migrated to: https://www.mozilla.org/mpl/ ([https](https://www.mozilla.org/mpl/) result 301). * http://www.rabbitmq.com/man/rabbitmq-plugins.1.man.html with 1 occurrences migrated to: https://www.rabbitmq.com/man/rabbitmq-plugins.1.man.html ([https](https://www.rabbitmq.com/man/rabbitmq-plugins.1.man.html) result 301). * http://www.w3.org/TR/css3-selectors/ with 1 occurrences migrated to: https://www.w3.org/TR/css3-selectors/ ([https](https://www.w3.org/TR/css3-selectors/) result 301). * http://www.whatwg.org/specs/web-apps/current-work/ with 1 occurrences migrated to: https://www.whatwg.org/specs/web-apps/current-work/ ([https](https://www.whatwg.org/specs/web-apps/current-work/) result 301). * http://zhongwencool.github.io/observer_cli with 1 occurrences migrated to: https://zhongwencool.github.io/observer_cli ([https](https://zhongwencool.github.io/observer_cli) result 301). * http://developer.mozilla.org/en/docs/Canvas_tutorial:Drawing_shapes with 1 occurrences migrated to: https://developer.mozilla.org/en/docs/Canvas_tutorial:Drawing_shapes ([https](https://developer.mozilla.org/en/docs/Canvas_tutorial:Drawing_shapes) result 302). * http://javascript.crockford.com/jsmin.html with 1 occurrences migrated to: https://javascript.crockford.com/jsmin.html ([https](https://javascript.crockford.com/jsmin.html) result 302). * http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx with 2 occurrences migrated to: https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx ([https](https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx) result 302). * http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context with 1 occurrences migrated to: https://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context ([https](https://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context) result 302). # Ignored These URLs were intentionally ignored. * http://localhost with 2 occurrences * http://localhost/ with 2 occurrences * http://localhost:15672/ with 1 occurrences * http://localhost:15672/api/channels?sort=message_stats.publish_details.rate&amp;sort_reverse=true&amp;columns=name,message_stats.publish_details.rate,message_stats.deliver_get_details.rate with 2 occurrences * http://localhost:15672/api/exchanges/%2F/my-new-exchange with 4 occurrences * http://localhost:15672/api/vhosts with 2 occurrences * http://localhost:15672/api/vhosts/foo with 2 occurrences
2019-03-20 16:17:48 +08:00
// https://support.microsoft.com/kb/186063
// MSIE6 appears to do this in response to HTTP 204.
}
}
2011-03-16 19:34:55 +08:00
if (check_bad_response(req, false)) {
if (type == 'GET')
return req.responseText;
else
// rabbitmq/rabbitmq-management#732
// https://developer.mozilla.org/en-US/docs/Glossary/Truthy
return {result: true, http_status: req.status, req_params: params};
}
else {
return false;
}
}
function initiate_logout(error = "") {
clear_pref('auth');
clear_cookie_value('auth');
renderWarningMessageInLoginStatus(error);
}
2011-03-16 19:34:55 +08:00
function check_bad_response(req, full_page_404) {
URL Cleanup This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener). # HTTP URLs that Could Not Be Fixed These URLs were unable to be fixed. Please review them to see if they can be manually resolved. * http://blog.listincomprehension.com/search/label/procket (200) with 1 occurrences could not be migrated: ([https](https://blog.listincomprehension.com/search/label/procket) result ClosedChannelException). * http://dozzie.jarowit.net/trac/wiki/TOML (200) with 1 occurrences could not be migrated: ([https](https://dozzie.jarowit.net/trac/wiki/TOML) result SSLHandshakeException). * http://dozzie.jarowit.net/trac/wiki/subproc (200) with 1 occurrences could not be migrated: ([https](https://dozzie.jarowit.net/trac/wiki/subproc) result SSLHandshakeException). * http://e2project.org (200) with 1 occurrences could not be migrated: ([https](https://e2project.org) result AnnotatedConnectException). * http://erik.eae.net/archives/2007/07/27/18.54.15/ (200) with 1 occurrences could not be migrated: ([https](https://erik.eae.net/archives/2007/07/27/18.54.15/) result SSLHandshakeException). * http://javascript.nwbox.com/IEContentLoaded/ (200) with 1 occurrences could not be migrated: ([https](https://javascript.nwbox.com/IEContentLoaded/) result SSLHandshakeException). * http://nitrogenproject.com/ (200) with 2 occurrences could not be migrated: ([https](https://nitrogenproject.com/) result ConnectTimeoutException). * http://proper.softlab.ntua.gr (200) with 1 occurrences could not be migrated: ([https](https://proper.softlab.ntua.gr) result SSLHandshakeException). * http://sammyjs.org (200) with 2 occurrences could not be migrated: ([https](https://sammyjs.org) result SSLHandshakeException). * http://sammyjs.org/docs/plugins (200) with 2 occurrences could not be migrated: ([https](https://sammyjs.org/docs/plugins) result SSLHandshakeException). * http://sammyjs.org/docs/routes (200) with 2 occurrences could not be migrated: ([https](https://sammyjs.org/docs/routes) result SSLHandshakeException). * http://webfx.eae.net/dhtml/boxsizing/boxsizing.html (200) with 1 occurrences could not be migrated: ([https](https://webfx.eae.net/dhtml/boxsizing/boxsizing.html) result SSLHandshakeException). * http://yaws.hyber.org (200) with 1 occurrences could not be migrated: ([https](https://yaws.hyber.org) result AnnotatedConnectException). * http://choven.ca (503) with 1 occurrences could not be migrated: ([https](https://choven.ca) result ConnectTimeoutException). # Fixed URLs ## Fixed But Review Recommended These URLs were fixed, but the https status was not OK. However, the https status was the same as the http request or http redirected to an https URL, so they were migrated. Your review is recommended. * http://fixprotocol.org/ (301) with 1 occurrences migrated to: https://fixtrading.org ([https](https://fixprotocol.org/) result SSLHandshakeException). * http://jsperf.com/getall-vs-sizzle/2 (301) with 1 occurrences migrated to: https://jsperf.com/getall-vs-sizzle/2 ([https](https://jsperf.com/getall-vs-sizzle/2) result ReadTimeoutException). * http://erldb.org (UnknownHostException) with 1 occurrences migrated to: https://erldb.org ([https](https://erldb.org) result UnknownHostException). * http://some-host-that-does-not-exist:15672/ (UnknownHostException) with 1 occurrences migrated to: https://some-host-that-does-not-exist:15672/ ([https](https://some-host-that-does-not-exist:15672/) result UnknownHostException). * http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ (301) with 1 occurrences migrated to: https://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ ([https](https://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/) result 404). * http://www.JSON.org/js.html (404) with 1 occurrences migrated to: https://www.JSON.org/js.html ([https](https://www.JSON.org/js.html) result 404). ## Fixed Success These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended. * http://bugs.jquery.com/ticket/12359 with 1 occurrences migrated to: https://bugs.jquery.com/ticket/12359 ([https](https://bugs.jquery.com/ticket/12359) result 200). * http://bugs.jquery.com/ticket/13378 with 1 occurrences migrated to: https://bugs.jquery.com/ticket/13378 ([https](https://bugs.jquery.com/ticket/13378) result 200). * http://cloudi.org/ with 27 occurrences migrated to: https://cloudi.org/ ([https](https://cloudi.org/) result 200). * http://code.quirkey.com/sammy/ with 1 occurrences migrated to: https://code.quirkey.com/sammy/ ([https](https://code.quirkey.com/sammy/) result 200). * http://erlware.org/ with 1 occurrences migrated to: https://erlware.org/ ([https](https://erlware.org/) result 200). * http://inaka.github.io/cowboy-trails/ with 1 occurrences migrated to: https://inaka.github.io/cowboy-trails/ ([https](https://inaka.github.io/cowboy-trails/) result 200). * http://jquery.com/ with 3 occurrences migrated to: https://jquery.com/ ([https](https://jquery.com/) result 200). * http://jsperf.com/thor-indexof-vs-for/5 with 1 occurrences migrated to: https://jsperf.com/thor-indexof-vs-for/5 ([https](https://jsperf.com/thor-indexof-vs-for/5) result 200). * http://ninenines.eu with 6 occurrences migrated to: https://ninenines.eu ([https](https://ninenines.eu) result 200). * http://ninenines.eu/ with 1 occurrences migrated to: https://ninenines.eu/ ([https](https://ninenines.eu/) result 200). * http://sizzlejs.com/ with 2 occurrences migrated to: https://sizzlejs.com/ ([https](https://sizzlejs.com/) result 200). * http://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/ with 1 occurrences migrated to: https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/ ([https](https://web.archive.org/web/20100324014747/https://blindsignals.com/index.php/2009/07/jquery-delay/) result 200). * http://www.actordb.com/ with 2 occurrences migrated to: https://www.actordb.com/ ([https](https://www.actordb.com/) result 200). * http://www.cs.kent.ac.uk/projects/wrangler/Home.html with 1 occurrences migrated to: https://www.cs.kent.ac.uk/projects/wrangler/Home.html ([https](https://www.cs.kent.ac.uk/projects/wrangler/Home.html) result 200). * http://www.enhanceie.com/ie/bugs.asp with 1 occurrences migrated to: https://www.enhanceie.com/ie/bugs.asp ([https](https://www.enhanceie.com/ie/bugs.asp) result 200). * http://www.rabbitmq.com/amqp-0-9-1-reference.html with 1 occurrences migrated to: https://www.rabbitmq.com/amqp-0-9-1-reference.html ([https](https://www.rabbitmq.com/amqp-0-9-1-reference.html) result 200). * http://www.rabbitmq.com/configure.html with 1 occurrences migrated to: https://www.rabbitmq.com/configure.html ([https](https://www.rabbitmq.com/configure.html) result 200). * http://www.rabbitmq.com/confirms.html with 1 occurrences migrated to: https://www.rabbitmq.com/confirms.html ([https](https://www.rabbitmq.com/confirms.html) result 200). * http://www.rabbitmq.com/consumers.html with 1 occurrences migrated to: https://www.rabbitmq.com/consumers.html ([https](https://www.rabbitmq.com/consumers.html) result 200). * http://www.rabbitmq.com/github.html with 1 occurrences migrated to: https://www.rabbitmq.com/github.html ([https](https://www.rabbitmq.com/github.html) result 200). * http://www.rabbitmq.com/ha.html with 3 occurrences migrated to: https://www.rabbitmq.com/ha.html ([https](https://www.rabbitmq.com/ha.html) result 200). * http://www.rabbitmq.com/management-cli.html with 1 occurrences migrated to: https://www.rabbitmq.com/management-cli.html ([https](https://www.rabbitmq.com/management-cli.html) result 200). * http://www.rabbitmq.com/management.html with 7 occurrences migrated to: https://www.rabbitmq.com/management.html ([https](https://www.rabbitmq.com/management.html) result 200). * http://www.rabbitmq.com/memory-use.html with 3 occurrences migrated to: https://www.rabbitmq.com/memory-use.html ([https](https://www.rabbitmq.com/memory-use.html) result 200). * http://www.rabbitmq.com/memory.html with 3 occurrences migrated to: https://www.rabbitmq.com/memory.html ([https](https://www.rabbitmq.com/memory.html) result 200). * http://www.rabbitmq.com/nettick.html with 1 occurrences migrated to: https://www.rabbitmq.com/nettick.html ([https](https://www.rabbitmq.com/nettick.html) result 200). * http://www.rabbitmq.com/partitions.html with 2 occurrences migrated to: https://www.rabbitmq.com/partitions.html ([https](https://www.rabbitmq.com/partitions.html) result 200). * http://www.rabbitmq.com/persistence-conf.html with 2 occurrences migrated to: https://www.rabbitmq.com/persistence-conf.html ([https](https://www.rabbitmq.com/persistence-conf.html) result 200). * http://www.rabbitmq.com/services.html with 1 occurrences migrated to: https://www.rabbitmq.com/services.html ([https](https://www.rabbitmq.com/services.html) result 200). * http://www.rebar3.org with 1 occurrences migrated to: https://www.rebar3.org ([https](https://www.rebar3.org) result 200). * http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html with 1 occurrences migrated to: https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html ([https](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html) result 200). * http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html with 1 occurrences migrated to: https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html ([https](https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html) result 200). * http://www.w3.org/TR/2011/REC-css3-selectors-20110929/ with 2 occurrences migrated to: https://www.w3.org/TR/2011/REC-css3-selectors-20110929/ ([https](https://www.w3.org/TR/2011/REC-css3-selectors-20110929/) result 200). * http://www.w3.org/TR/CSS21/syndata.html with 2 occurrences migrated to: https://www.w3.org/TR/CSS21/syndata.html ([https](https://www.w3.org/TR/CSS21/syndata.html) result 200). * http://www.w3.org/TR/DOM-Level-3-Events/ with 1 occurrences migrated to: https://www.w3.org/TR/DOM-Level-3-Events/ ([https](https://www.w3.org/TR/DOM-Level-3-Events/) result 200). * http://www.w3.org/TR/selectors/ with 4 occurrences migrated to: https://www.w3.org/TR/selectors/ ([https](https://www.w3.org/TR/selectors/) result 200). * http://code.google.com/p/stringencoders/ with 1 occurrences migrated to: https://code.google.com/p/stringencoders/ ([https](https://code.google.com/p/stringencoders/) result 301). * http://code.google.com/p/stringencoders/source/browse/ with 2 occurrences migrated to: https://code.google.com/p/stringencoders/source/browse/ ([https](https://code.google.com/p/stringencoders/source/browse/) result 301). * http://contributor-covenant.org with 1 occurrences migrated to: https://contributor-covenant.org ([https](https://contributor-covenant.org) result 301). * http://contributor-covenant.org/version/1/3/0/ with 1 occurrences migrated to: https://contributor-covenant.org/version/1/3/0/ ([https](https://contributor-covenant.org/version/1/3/0/) result 301). * http://dev.w3.org/csswg/cssom/ with 1 occurrences migrated to: https://dev.w3.org/csswg/cssom/ ([https](https://dev.w3.org/csswg/cssom/) result 301). * http://inaka.github.com/apns4erl with 1 occurrences migrated to: https://inaka.github.com/apns4erl ([https](https://inaka.github.com/apns4erl) result 301). * http://inaka.github.com/edis/ with 1 occurrences migrated to: https://inaka.github.com/edis/ ([https](https://inaka.github.com/edis/) result 301). * http://jquery.org/license with 2 occurrences migrated to: https://jquery.org/license ([https](https://jquery.org/license) result 301). * http://lasp-lang.org/ with 1 occurrences migrated to: https://lasp-lang.org/ ([https](https://lasp-lang.org/) result 301). * http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx with 1 occurrences migrated to: https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx ([https](https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx) result 301). * http://msdn.microsoft.com/en-us/library/ie/ms536648 with 1 occurrences migrated to: https://msdn.microsoft.com/en-us/library/ie/ms536648 ([https](https://msdn.microsoft.com/en-us/library/ie/ms536648) result 301). * http://rabbitmq.com with 5 occurrences migrated to: https://rabbitmq.com ([https](https://rabbitmq.com) result 301). * http://rabbitmq.com/ae.html with 1 occurrences migrated to: https://rabbitmq.com/ae.html ([https](https://rabbitmq.com/ae.html) result 301). * http://rabbitmq.com/consumers.html with 1 occurrences migrated to: https://rabbitmq.com/consumers.html ([https](https://rabbitmq.com/consumers.html) result 301). * http://rabbitmq.com/dlx.html with 2 occurrences migrated to: https://rabbitmq.com/dlx.html ([https](https://rabbitmq.com/dlx.html) result 301). * http://rabbitmq.com/maxlength.html with 2 occurrences migrated to: https://rabbitmq.com/maxlength.html ([https](https://rabbitmq.com/maxlength.html) result 301). * http://rabbitmq.com/passwords.html with 1 occurrences migrated to: https://rabbitmq.com/passwords.html ([https](https://rabbitmq.com/passwords.html) result 301). * http://rabbitmq.com/priority.html with 1 occurrences migrated to: https://rabbitmq.com/priority.html ([https](https://rabbitmq.com/priority.html) result 301). * http://rabbitmq.com/ttl.html with 2 occurrences migrated to: https://rabbitmq.com/ttl.html ([https](https://rabbitmq.com/ttl.html) result 301). * http://saleyn.github.com/erlexec with 1 occurrences migrated to: https://saleyn.github.com/erlexec ([https](https://saleyn.github.com/erlexec) result 301). * http://support.microsoft.com/kb/186063 with 1 occurrences migrated to: https://support.microsoft.com/kb/186063 ([https](https://support.microsoft.com/kb/186063) result 301). * http://technet.microsoft.com/en-us/sysinternals/bb896655 with 2 occurrences migrated to: https://technet.microsoft.com/en-us/sysinternals/bb896655 ([https](https://technet.microsoft.com/en-us/sysinternals/bb896655) result 301). * http://www.erlang.org/doc/man/sasl_app.html with 1 occurrences migrated to: https://www.erlang.org/doc/man/sasl_app.html ([https](https://www.erlang.org/doc/man/sasl_app.html) result 301). * http://www.mozilla.org/MPL/ with 86 occurrences migrated to: https://www.mozilla.org/MPL/ ([https](https://www.mozilla.org/MPL/) result 301). * http://www.mozilla.org/mpl/ with 3 occurrences migrated to: https://www.mozilla.org/mpl/ ([https](https://www.mozilla.org/mpl/) result 301). * http://www.rabbitmq.com/man/rabbitmq-plugins.1.man.html with 1 occurrences migrated to: https://www.rabbitmq.com/man/rabbitmq-plugins.1.man.html ([https](https://www.rabbitmq.com/man/rabbitmq-plugins.1.man.html) result 301). * http://www.w3.org/TR/css3-selectors/ with 1 occurrences migrated to: https://www.w3.org/TR/css3-selectors/ ([https](https://www.w3.org/TR/css3-selectors/) result 301). * http://www.whatwg.org/specs/web-apps/current-work/ with 1 occurrences migrated to: https://www.whatwg.org/specs/web-apps/current-work/ ([https](https://www.whatwg.org/specs/web-apps/current-work/) result 301). * http://zhongwencool.github.io/observer_cli with 1 occurrences migrated to: https://zhongwencool.github.io/observer_cli ([https](https://zhongwencool.github.io/observer_cli) result 301). * http://developer.mozilla.org/en/docs/Canvas_tutorial:Drawing_shapes with 1 occurrences migrated to: https://developer.mozilla.org/en/docs/Canvas_tutorial:Drawing_shapes ([https](https://developer.mozilla.org/en/docs/Canvas_tutorial:Drawing_shapes) result 302). * http://javascript.crockford.com/jsmin.html with 1 occurrences migrated to: https://javascript.crockford.com/jsmin.html ([https](https://javascript.crockford.com/jsmin.html) result 302). * http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx with 2 occurrences migrated to: https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx ([https](https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx) result 302). * http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context with 1 occurrences migrated to: https://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context ([https](https://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context) result 302). # Ignored These URLs were intentionally ignored. * http://localhost with 2 occurrences * http://localhost/ with 2 occurrences * http://localhost:15672/ with 1 occurrences * http://localhost:15672/api/channels?sort=message_stats.publish_details.rate&amp;sort_reverse=true&amp;columns=name,message_stats.publish_details.rate,message_stats.deliver_get_details.rate with 2 occurrences * http://localhost:15672/api/exchanges/%2F/my-new-exchange with 4 occurrences * http://localhost:15672/api/vhosts with 2 occurrences * http://localhost:15672/api/vhosts/foo with 2 occurrences
2019-03-20 16:17:48 +08:00
// 1223 == 204 - see https://www.enhanceie.com/ie/bugs.asp
// MSIE7 and 8 appear to do this in response to HTTP 204.
if ((req.status >= 200 && req.status < 300) || req.status == 1223) {
return true;
}
2011-03-16 19:34:55 +08:00
else if (req.status == 404 && full_page_404) {
var html = format('404', {});
replace_content('main', html);
}
2015-10-22 18:46:52 +08:00
else if (req.status >= 400 && req.status <= 404) {
var reason = JSON.parse(req.responseText).reason;
if (typeof(reason) != 'string') reason = JSON.stringify(reason);
2015-10-22 15:55:36 +08:00
var error = JSON.parse(req.responseText).error;
if (typeof(error) != 'string') error = JSON.stringify(error);
if (error == 'bad_request' || error == 'not_found' || error == 'not_authorised' || error == 'not_authorized') {
if ((req.status == 401 || req.status == 403) && oauth.enabled) {
initiate_logout(reason);
} else {
show_popup('warn', fmt_escape_html(reason));
}
} else if (error == 'page_out_of_range') {
2015-11-17 23:59:49 +08:00
var seconds = 60;
if (last_page_out_of_range_error > 0)
seconds = (new Date().getTime() - last_page_out_of_range_error.getTime())/1000;
2015-11-17 23:59:49 +08:00
if (seconds > 3) {
Sammy.log('server reports page is out of range, redirecting to page 1');
2015-11-19 17:33:20 +08:00
var contexts = ["queues", "exchanges", "connections", "channels"];
2015-11-19 19:42:35 +08:00
var matches = /api\/(.*)\?/.exec(req.responseURL);
if (matches != null && matches.length > 1) {
contexts.forEach(function(item) {
2015-11-19 19:42:35 +08:00
if (matches[1].indexOf(item) == 0) {update_pages(item, 1)};
});
2016-01-25 16:58:09 +08:00
} else update_pages(current_template, 1);
2016-01-26 06:51:53 +08:00
last_page_out_of_range_error = new Date();
2015-11-17 23:59:49 +08:00
}
}
2015-10-13 21:53:20 +08:00
}
else if (req.status == 408) {
update_status('timeout');
}
else if (req.status == 0) { // Non-MSIE: could not connect
update_status('error');
}
else if (req.status > 12000) { // MSIE: could not connect
update_status('error');
}
else if (req.status == 503) { // Proxy: could not connect
update_status('error');
}
else {
debug("Management API returned status code " + req.status + " - <strong>" + fmt_escape_html_one_line(req.responseText) + "</strong>");
clearInterval(timer);
}
return false;
}
2010-07-13 20:03:36 +08:00
2010-08-25 01:46:30 +08:00
function fill_path_template(template, params) {
var re = /:[a-zA-Z_]*/g;
return template.replace(re, function(m) {
var str = esc(params[m.substring(1)]);
if (str == '') {
throw(m.substring(1) + " is required");
}
return str;
2010-08-25 01:46:30 +08:00
});
}
2010-12-09 01:40:10 +08:00
function params_magic(params) {
return check_password(maybe_remove_fields(collapse_multifields(params)));
2010-12-09 01:40:10 +08:00
}
2010-10-12 21:08:17 +08:00
function collapse_multifields(params0) {
2013-05-15 22:19:11 +08:00
function set(x) { return x != '' && x != undefined }
2010-10-12 21:08:17 +08:00
var params = {};
var ks = keys(params0);
var ids = [];
for (i in ks) {
var key = ks[i];
var match = key.match(/([a-z]*)_([0-9_]*)_mftype/);
var match2 = key.match(/[a-z]*_[0-9_]*_mfkey/);
var match3 = key.match(/[a-z]*_[0-9_]*_mfvalue/);
if (match == null && match2 == null && match3 == null) {
2010-10-12 21:08:17 +08:00
params[key] = params0[key];
}
else if (match == null) {
// Do nothing, value is handled below
}
else {
var name = match[1];
var id = match[2];
ids.push([name, id]);
}
}
ids.sort();
var id_map = {};
for (i in ids) {
var name = ids[i][0];
var id = ids[i][1];
if (params[name] == undefined) {
params[name] = {};
id_map[name] = {};
}
var id_parts = id.split('_');
var k = params0[name + '_' + id_parts[0] + '_mfkey'];
var v = params0[name + '_' + id + '_mfvalue'];
var t = params0[name + '_' + id + '_mftype'];
2013-05-15 22:04:33 +08:00
var val = null;
var top_level = id_parts.length == 1;
2013-05-15 22:04:33 +08:00
if (t == 'list') {
val = [];
id_map[name][id] = val;
}
else if ((set(k) && top_level) || set(v)) {
if (t == 'boolean') {
if (v != 'true' && v != 'false')
throw(k + ' must be "true" or "false"; got ' + v);
val = (v == 'true');
2010-10-12 21:08:17 +08:00
}
else if (t == 'number') {
var n = parseFloat(v);
if (isNaN(n))
throw(k + ' must be a number; got ' + v);
val = n;
}
else {
val = v;
}
2013-05-15 22:04:33 +08:00
}
if (val != null) {
if (top_level) {
params[name][k] = val;
}
else {
var prefix = id_parts.slice(0, id_parts.length - 1).join('_');
id_map[name][prefix].push(val);
2010-10-12 21:08:17 +08:00
}
}
}
if (params.hasOwnProperty('queuetype')) {
delete params['queuetype'];
if (queue_type != 'default') {
params['arguments']['x-queue-type'] = queue_type;
}
2020-02-21 23:18:32 +08:00
if (queue_type == 'quorum' ||
queue_type == 'stream') {
params['durable'] = true;
params['auto_delete'] = false;
}
}
2010-10-12 21:08:17 +08:00
return params;
}
2011-03-09 02:43:14 +08:00
function check_password(params) {
if (params['password'] != undefined) {
if (params['password'] == '') {
throw("Please specify a password.");
}
2011-03-09 02:43:14 +08:00
if (params['password'] != params['password_confirm']) {
throw("Passwords do not match.");
}
delete params['password_confirm'];
}
return params;
}
function maybe_remove_fields(params) {
$('.controls-appearance').each(function(index) {
var options = $(this).get(0).options;
var selected = $(this).val();
for (i = 0; i < options.length; i++) {
var option = options[i].value;
if (option != selected) {
delete params[option];
}
}
delete params[$(this).attr('name')];
});
2010-12-09 01:40:10 +08:00
return params;
}
function put_parameter(sammy, mandatory_keys, num_keys, bool_keys,
arrayable_keys) {
2012-05-18 22:33:13 +08:00
for (var i in sammy.params) {
if (i === 'length' || !sammy.params.hasOwnProperty(i)) continue;
if (sammy.params[i] == '' && jQuery.inArray(i, mandatory_keys) == -1) {
2012-05-18 22:33:13 +08:00
delete sammy.params[i];
}
else if (jQuery.inArray(i, num_keys) != -1) {
2012-05-18 22:33:13 +08:00
sammy.params[i] = parseInt(sammy.params[i]);
}
else if (jQuery.inArray(i, bool_keys) != -1) {
sammy.params[i] = sammy.params[i] == 'true';
}
else if (jQuery.inArray(i, arrayable_keys) != -1) {
sammy.params[i] = sammy.params[i].split(' ');
if (sammy.params[i].length == 1) {
sammy.params[i] = sammy.params[i][0];
}
}
2012-05-18 22:33:13 +08:00
}
var params = {"component": sammy.params.component,
2012-08-08 00:39:09 +08:00
"vhost": sammy.params.vhost,
2012-10-22 22:07:50 +08:00
"name": sammy.params.name,
2012-05-18 22:33:13 +08:00
"value": params_magic(sammy.params)};
2012-08-08 00:39:09 +08:00
delete params.value.vhost;
2012-05-18 22:33:13 +08:00
delete params.value.component;
2012-10-22 22:07:50 +08:00
delete params.value.name;
2012-05-18 22:33:13 +08:00
sammy.params = params;
2012-10-22 22:07:50 +08:00
if (sync_put(sammy, '/parameters/:component/:vhost/:name')) update();
2012-05-18 22:33:13 +08:00
}
function put_cast_params(sammy, path, mandatory_keys, num_keys, bool_keys) {
2012-10-08 22:06:56 +08:00
for (var i in sammy.params) {
if (i === 'length' || !sammy.params.hasOwnProperty(i)) continue;
if (sammy.params[i] == '' && jQuery.inArray(i, mandatory_keys) == -1) {
2012-10-08 22:06:56 +08:00
delete sammy.params[i];
}
else if (jQuery.inArray(i, num_keys) != -1) {
2012-10-08 22:06:56 +08:00
sammy.params[i] = parseInt(sammy.params[i]);
}
else if (jQuery.inArray(i, bool_keys) != -1) {
2012-10-08 22:06:56 +08:00
sammy.params[i] = sammy.params[i] == 'true';
}
}
if (sync_put(sammy, path)) update();
2012-10-08 22:06:56 +08:00
}
2012-05-18 22:33:13 +08:00
function update_column_options(sammy) {
var mode = sammy.params['mode'];
for (var group in COLUMNS[mode]) {
var options = COLUMNS[mode][group];
for (var i = 0; i < options.length; i++) {
var key = options[i][0];
var value = sammy.params[mode + '-' + key] != undefined;
store_pref('column-' + mode + '-' + key, value);
}
}
partial_update();
}
2010-07-13 20:03:36 +08:00
function debug(str) {
$('<p>' + str + '</p>').appendTo('#debug');
}
function keys(obj) {
var ks = [];
for (var k in obj) {
ks.push(k);
}
return ks;
}
// Don't use the jQuery AJAX support, it seems to have trouble reporting
// server-down type errors.
function xmlHttpRequest() {
var res;
try {
res = new XMLHttpRequest();
}
catch(e) {
res = new ActiveXObject("Microsoft.XMLHttp");
}
return res;
}
2012-11-07 19:39:57 +08:00
(function($){
$.fn.extend({
center: function () {
return this.each(function() {
var top = ($(window).height() - $(this).outerHeight()) / 2;
var left = ($(window).width() - $(this).outerWidth()) / 2;
$(this).css({margin:0, top: (top > 0 ? top : 0)+'px', left: (left > 0 ? left : 0)+'px'});
});
}
});
2012-10-08 22:06:56 +08:00
})(jQuery);
2013-04-08 21:00:06 +08:00
function debounce(f, delay) {
var timeout = null;
return function() {
var obj = this;
var args = arguments;
function delayed () {
f.apply(obj, args);
timeout = null;
}
if (timeout) clearTimeout(timeout);
timeout = setTimeout(delayed, delay);
}
}
function rename_multifield(params, from, to) {
var new_params = {};
for(var key in params){
var match = key.match("^" + from + "_[0-9_]*_mftype$");
var match2 = key.match("^" + from + "_[0-9_]*_mfkey$");
var match3 = key.match("^" + from + "_[0-9_]*_mfvalue$");
if (match != null) {
new_params[match[0].replace(from, to)] = params[match];
}
else if (match2 != null) {
new_params[match2[0].replace(from, to)] = params[match2];
}
else if (match3 != null) {
new_params[match3[0].replace(from, to)] = params[match3];
}
else {
new_params[key] = params[key]
}
}
return new_params;
}
function select_queue_type(queuetype) {
queue_type = queuetype.value;
update();
}
function is_quorum(queue) {
if (queue["arguments"]) {
if (queue["arguments"]["x-queue-type"]) {
return queue["arguments"]["x-queue-type"] === "quorum";
} else {
return false;
}
} else {
return false;
}
}
2020-02-21 23:18:32 +08:00
function is_stream(queue) {
if (queue["arguments"]) {
if (queue["arguments"]["x-queue-type"]) {
return queue["arguments"]["x-queue-type"] === "stream";
} else {
return false;
}
} else {
return false;
}
}
function is_classic(queue) {
if (queue["arguments"]) {
if (queue["arguments"]["x-queue-type"]) {
return queue["arguments"]["x-queue-type"] === "classic";
} else {
return true;
}
} else {
return true;
}
}
function ensure_queues_chart_range() {
var range = get_pref('chart-range');
// Note: the queues page uses the 'basic' range type
var fixup_range;
var valid_range = false;
var range_type = get_chart_range_type('queues');
var chart_periods = CHART_RANGES[range_type];
for (var i = 0; i < chart_periods.length; ++i) {
var data = chart_periods[i];
var val = data[0];
if (range === val) {
valid_range = true;
break;
}
// If the range needs to be adjusted, use the last
// valid one
fixup_range = val;
}
if (!valid_range) {
store_pref('chart-range', fixup_range);
}
}
function get_chart_range_type(arg) {
/*
* 'arg' can be:
* lengths-over for the Overview page
* lengths-q for the per-queue page
* queues for setting up the queues range
*/
if (arg === 'lengths-over') {
return 'global';
}
if (arg === 'msg-rates-over') {
return 'global';
}
if (arg === 'lengths-q') {
return 'basic';
}
if (arg === 'msg-rates-q') {
return 'basic';
}
if (arg === 'queues') {
return 'basic';
}
if (arg === 'queue-churn') {
return 'basic';
}
if (arg === 'channel-churn') {
return 'basic';
}
if (arg === 'connection-churn') {
return 'basic';
}
console.log('[WARNING]: range type not found for arg: ' + arg);
return 'basic';
}