2018-06-27 02:59:59 +00:00
|
|
|
$(".service_li").on('click', function() {
|
|
|
|
var id = $(this).attr('data-id');
|
|
|
|
var position = $("#service_id_"+id).offset();
|
|
|
|
window.scroll(0,position.top-23);
|
|
|
|
return false;
|
2018-06-28 07:28:07 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
2018-06-30 02:19:19 +00:00
|
|
|
$('form').submit(function() {
|
|
|
|
$(this).find("button[type='submit']").prop('disabled',true);
|
2018-06-30 00:57:05 +00:00
|
|
|
});
|
|
|
|
|
2018-07-18 23:01:24 +00:00
|
|
|
$('select#service_type').on('change', function() {
|
|
|
|
var selected = $('#service_type option:selected').val();
|
|
|
|
if (selected == "tcp") {
|
|
|
|
$("#service_port").parent().parent().removeClass("d-none");
|
|
|
|
$("#service_check_type").parent().parent().addClass("d-none");
|
2018-07-19 03:20:43 +00:00
|
|
|
$("#service_url").attr("placeholder", "localhost");
|
2018-07-18 23:01:24 +00:00
|
|
|
|
|
|
|
$("#post_data").parent().parent().addClass("d-none");
|
|
|
|
$("#service_response").parent().parent().addClass("d-none");
|
|
|
|
$("#service_response_code").parent().parent().addClass("d-none");
|
|
|
|
} else {
|
|
|
|
$("#post_data").parent().parent().removeClass("d-none");
|
|
|
|
$("#service_response").parent().parent().removeClass("d-none");
|
|
|
|
$("#service_response_code").parent().parent().removeClass("d-none");
|
|
|
|
$("#service_check_type").parent().parent().removeClass("d-none");
|
2018-07-19 03:20:43 +00:00
|
|
|
$("#service_url").attr("placeholder", "https://google.com");
|
2018-07-18 23:01:24 +00:00
|
|
|
|
|
|
|
$("#service_port").parent().parent().addClass("d-none");
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2018-07-22 22:17:38 +00:00
|
|
|
$('select#service_check_type').on('change', function() {
|
|
|
|
var selected = $('#service_check_type option:selected').val();
|
|
|
|
if (selected == "POST") {
|
|
|
|
$("#post_data").parent().parent().removeClass("d-none");
|
|
|
|
} else {
|
|
|
|
$("#post_data").parent().parent().addClass("d-none");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2018-07-20 05:26:41 +00:00
|
|
|
|
|
|
|
$(function() {
|
|
|
|
var pathname = window.location.pathname;
|
|
|
|
if (pathname=="/logs") {
|
|
|
|
var lastline;
|
|
|
|
setInterval(function() {
|
|
|
|
var xhr = new XMLHttpRequest();
|
|
|
|
xhr.open('GET', '/logs/line');
|
|
|
|
xhr.onload = function () {
|
|
|
|
if (xhr.status === 200) {
|
|
|
|
if (lastline != xhr.responseText) {
|
|
|
|
var curr = $.trim($("#live_logs").text());
|
|
|
|
var line = xhr.responseText.replace(/(\r\n|\n|\r)/gm," ");
|
|
|
|
line = line+"\n";
|
|
|
|
$("#live_logs").text(line+curr);
|
|
|
|
lastline = xhr.responseText;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
xhr.send();
|
|
|
|
}, 200);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2018-06-30 00:57:05 +00:00
|
|
|
|
2018-07-08 21:06:10 +00:00
|
|
|
$(".confirm-btn").on('click', function() {
|
|
|
|
var r = confirm("Are you sure you want to delete?");
|
|
|
|
if (r == true) {
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2018-06-30 02:19:19 +00:00
|
|
|
|
2018-07-17 09:18:20 +00:00
|
|
|
$(".select-input").on("click", function () {
|
|
|
|
$(this).select();
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2018-06-28 07:28:07 +00:00
|
|
|
var ranVar = false;
|
|
|
|
var ranTheme = false;
|
|
|
|
$('a[data-toggle="pill"]').on('shown.bs.tab', function (e) {
|
|
|
|
var target = $(e.target).attr("href");
|
|
|
|
if (target=="#v-pills-style" && !ranVar) {
|
|
|
|
var sass_vars = CodeMirror.fromTextArea(document.getElementById("sass_vars"), {
|
|
|
|
lineNumbers: true,
|
|
|
|
matchBrackets: true,
|
|
|
|
mode: "text/x-scss",
|
|
|
|
colorpicker : true
|
|
|
|
});
|
|
|
|
ranVar = true;
|
|
|
|
} else if (target=="#pills-theme" && !ranTheme) {
|
|
|
|
var theme_css = CodeMirror.fromTextArea(document.getElementById("theme_css"), {
|
|
|
|
lineNumbers: true,
|
|
|
|
matchBrackets: true,
|
|
|
|
mode: "text/x-scss",
|
|
|
|
colorpicker : true
|
|
|
|
});
|
|
|
|
ranTheme = true;
|
|
|
|
}
|
2018-06-27 02:59:59 +00:00
|
|
|
});
|