This commit is contained in:
flaskfarm
2022-10-25 12:12:04 +09:00
parent b19a5072ba
commit 26835c2cbb
14 changed files with 545 additions and 548 deletions

View File

@@ -130,6 +130,175 @@ $("body").on('click', '#globalCliboardBtn', function(e) {
});
// 사용 on / off
$("body").on('change', '#globalSchedulerSwitchBtn', function(e) {
e.preventDefault();
var ret = $(this).prop('checked');
$.ajax({
url: '/'+PACKAGE_NAME+'/ajax/' + MODULE_NAME + '/scheduler',
type: "POST",
cache: false,
data: {scheduler : ret},
dataType: "json",
success: function () {}
});
});
$("body").on('change', '#globalSchedulerSwitchPageBtn', function(e) {
var ret = $(this).prop('checked');
$.ajax({
url: '/'+PACKAGE_NAME+'/ajax/' + MODULE_NAME + '/' + PAGE_NAME + '/scheduler',
type: "POST",
cache: false,
data: {scheduler : ret},
dataType: "json",
success: function () {}
});
});
$("body").on('click', '#globalOneExecuteBtn', function(e) {
e.preventDefault();
$.ajax({
url: '/'+PACKAGE_NAME+'/ajax/' + MODULE_NAME + '/one_execute',
type: "POST",
cache: false,
data: {},
dataType: "json",
success: function (ret) {
if (ret=='scheduler' || ret=='thread') {
$.notify('<strong>작업을 시작하였습니다. ('+ret+')</strong>', {
type: 'success'
});
} else if (ret == 'is_running') {
$.notify('<strong>작업중입니다.</strong>', {
type: 'warning'
});
} else {
$.notify('<strong>작업 시작에 실패하였습니다.</strong>', {
type: 'warning'
});
}
}
});
});
$("body").on('click', '#globalOneExecutePageBtn', function(e) {
e.preventDefault();
$.ajax({
url: '/'+PACKAGE_NAME+'/ajax/' + MODULE_NAME + '/' + PAGE_NAME + '/one_execute',
type: "POST",
cache: false,
data: {sub:sub},
dataType: "json",
success: function (ret) {
if (ret=='scheduler' || ret=='thread') {
$.notify('<strong>작업을 시작하였습니다. ('+ret+')</strong>', {
type: 'success'
});
} else if (ret == 'is_running') {
$.notify('<strong>작업중입니다.</strong>', {
type: 'warning'
});
} else {
$.notify('<strong>작업 시작에 실패하였습니다.</strong>', {
type: 'warning'
});
}
}
});
});
$("body").on('click', '#globalImmediatelyExecuteBtn', function(e){
e.preventDefault();
$.ajax({
url: '/'+PACKAGE_NAME+'/ajax/' + MODULE_NAME + '/immediately_execute',
type: "POST",
cache: false,
data: {},
dataType: "json",
success: function (ret) {
if (ret.msg != null) notify(ret.msg, ret.ret);
}
});
});
$("body").on('click', '#globalImmediatelyExecutePageBtn', function(e){
e.preventDefault();
$.ajax({
url: '/'+PACKAGE_NAME+'/ajax/' + MODULE_NAME + '/' + PAGE_NAME + '/immediately_execute',
type: "POST",
cache: false,
data: {},
dataType: "json",
success: function (ret) {
if (ret.msg != null) notify(ret.msg, ret.ret);
}
});
});
$("body").on('click', '#globalDbDeleteBtn', function(e){
e.preventDefault();
document.getElementById("confirm_title").innerHTML = "DB 삭제";
document.getElementById("confirm_body").innerHTML = "전체 목록을 삭제 하시겠습니까?";
$('#confirm_button').attr('onclick', "globalDbDelete();");
$("#confirm_modal").modal();
return;
});
function globalDbDelete() {
$.ajax({
url: '/'+PACKAGE_NAME+'/ajax/' + MODULE_NAME + '/reset_db',
type: "POST",
cache: false,
data: {},
dataType: "json",
success: function (data) {
if (data) {
$.notify('<strong>삭제하였습니다.</strong>', {
type: 'success'
});
} else {
$.notify('<strong>삭제에 실패하였습니다.</strong>',{
type: 'warning'
});
}
}
});
}
$("body").on('click', '#globalDbDeletePageBtn', function(e){
e.preventDefault();
document.getElementById("confirm_title").innerHTML = "DB 삭제";
document.getElementById("confirm_body").innerHTML = "전체 목록을 삭제 하시겠습니까?";
$('#confirm_button').attr('onclick', "globalDbDeletePage();");
$("#confirm_modal").modal();
return;
});
function globalDbDeletePage() {
$.ajax({
url: '/'+PACKAGE_NAME+'/ajax/' + MODULE_NAME + '/' + PAGE_NAME + '/reset_db',
type: "POST",
cache: false,
data: {sub:sub},
dataType: "json",
success: function (data) {
if (data) {
$.notify('<strong>삭제하였습니다.</strong>', {
type: 'success'
});
} else {
$.notify('<strong>삭제에 실패하였습니다.</strong>',{
type: 'warning'
});
}
}
});
}
///////////////////////////////////////
// Global - 함수
///////////////////////////////////////
@@ -180,6 +349,88 @@ function shutdown_confirm() {
}
///////////////////////////////////////
// 리스트 화면 기본
///////////////////////////////////////
function globalRequestSearch(page, move_top=true) {
var formData = getFormdata('#form_search')
formData += '&page=' + page;
$.ajax({
url: '/' + PACKAGE_NAME + '/ajax/' + MODULE_NAME + '/web_list',
type: "POST",
cache: false,
data: formData,
dataType: "json",
success: function (data) {
current_data = data;
if (move_top)
window.scrollTo(0,0);
make_list(data.list)
make_page_html(data.paging)
}
});
}
function make_page_html(data) {
str = ' \
<div class="d-inline-block"></div> \
<div class="row mb-3"> \
<div class="col-sm-12"> \
<div class="btn-toolbar" style="justify-content: center;" role="toolbar" aria-label="Toolbar with button groups" > \
<div class="btn-group btn-group-sm mr-2" role="group" aria-label="First group">'
if (data.prev_page) {
str += '<button id="gloablSearchPageBtn" data-page="' + (data.start_page-1) + '" type="button" class="btn btn-secondary">&laquo;</button>'
}
for (var i = data.start_page ; i <= data.last_page ; i++) {
str += '<button id="gloablSearchPageBtn" data-page="' + i +'" type="button" class="btn btn-secondary" ';
if (i == data.current_page) {
str += 'disabled';
}
str += '>'+i+'</button>';
}
if (data.next_page) {
str += '<button id="gloablSearchPageBtn" data-page="' + (data.last_page+1) + '" type="button" class="btn btn-secondary">&raquo;</button>'
}
str += '</div> \
</div> \
</div> \
</div> \
'
document.getElementById("page1").innerHTML = str;
document.getElementById("page2").innerHTML = str;
}
$("body").on('click', '#gloablSearchPageBtn', function(e){
e.preventDefault();
globalRequestSearch($(this).data('page'), false);
});
$("body").on('click', '#globalSearchSearchBtn', function(e){
e.preventDefault();
globalRequestSearch(1, false);
});
$("body").on('click', '#globalSearchResetBtn', function(e){
e.preventDefault();
$("#order").val('desc');
$("#option1").val('all');
$("#option2").val('all');
$("#keyword").val('');
globalRequestSearch(1, false);
});
///////////////////////////////////////
// 파일 선택 모달
///////////////////////////////////////