This commit is contained in:
flaskfarm
2022-10-06 14:39:43 +09:00
parent 435c5c9c36
commit b4e737a6b2
19 changed files with 378 additions and 248 deletions

View File

@@ -0,0 +1,36 @@
{% extends "base.html" %}
{% block content %}
<div>
{{ macros.m_button_group([['saveBtn', '파일 저장']])}}
{{ macros.m_row_start('5') }}
{{ macros.m_row_end() }}
{{ macros.m_hr() }}
{{ macros.info_text_and_buttons('config_filepath', '파일 위치', [['globalEditBtn', '편집기에서 열기', [('file',arg['config_filepath'])]]], value=arg['config_filepath']) }}
{{ macros.setting_input_textarea('config', 'config.yaml', desc=['',
'App을 재시작 해야 적용됩니다.',
'',
'path_data : 필수. 데이터 폴더 경로. 윈도우의 경우 폴더 구분 기호 \ 를 두개 사용',
'use_gevent : 생략시 true',
'use_celery : 생략시 true',
'redis_port : 생략시 6379',
'port : 생략시 설정에 있는 DB port 사용. 설정시 DB 값보다 우선 사용',
'debug : 생략시 false. true인 경우 소스 수정시 재로딩',
'plugin_update : 생략시 true. 환경변수 UPDATE_STOP, PLUGIN_UPDATE_FROM_PYTHON 값이 설정된 경우에도 적용',
'running_type : termux, entware인 경우에만 입력',
'plugin_loading_only_devpath : true인 경우 플러그인 개발 폴더에 있는 것들만 로딩',
'plugin_loading_list : 생략시 적용 안함. 로딩할 모듈 패키지명 리스트',
'plugin_except_list : 생략시 적용 안함. 로딩 제외할 모듈 패키지명 리스트',
],
value=arg['config.yaml'], row='20') }}
</div>
<script type="text/javascript">
$("body").on('click', '#saveBtn', function(e){
e.preventDefault();
globalSendCommand('config_save', $('#config').val());
});
</script>
{% endblock %}

View File

@@ -1,144 +0,0 @@
{% extends "base.html" %}
{% block content %}
<div>
<nav>
{{ macros.m_tab_head_start() }}
{{ macros.m_tab_head2('system', '시스템 변수', true) }}
{{ macros.m_tab_head2('celery', 'celery 상태', false) }}
{{ macros.m_tab_head_end() }}
</nav>
<div class="tab-content" id="nav-tabContent">
{{ macros.m_tab_content_start('system', true) }}
<form id='setting' name='setting'>
{{ macros.setting_input_textarea('export', '환경변수', desc=['',
'도커를 재시작하거나 sjva3.sh 스크립트를 재시작해야 적용됩니다.',
'구동 환경에 따라 사용하는 변수가 다릅니다.',
'',
'USE_CELERY : 멀티프로세싱 작업 사용 여부 설정. true or false',
'CELERY_WORKER_COUNT : 작업 프로세스 개수.',
'USE_GEVENT : 비동기 라이브러리 사용 설정. true or false. 클수록 메모리를 많이 소비하는 대신 더 원할하게 동작', '',
'REDIS_PORT : celery에서 사용하는 redis port. 특별한 경우외에는 변경하지 마세요',
'SJVA_PORT : 이 변수가 있는 경우 DB값을 무시하고 port로 설정',
],
value=arg['export'], row='10') }}
{{ macros.setting_button([['setting_save_btn', '저장'], ['shutdown_btn', '시스템 종료']]) }}
</form>
</form>
{{ macros.m_tab_content_end() }}
{{ macros.m_tab_content_start('celery', false) }}
{{ macros.setting_button([['celery_test_btn', 'Celery Test'], ['worker_start_btn', '워커 재시작'], ['ps_btn', '프로세스 목록']]) }}
{{ macros.m_tab_content_end() }}
</div><!--tab-content-->
</div> <!--전체-->
<script type="text/javascript">
var package_name = "{{arg['package_name']}}";
var sub = "{{arg['sub'] }}";
$(document).ready(function(){
});
$("body").on('click', '#setting_save_btn', function(e){
e.preventDefault();
var formData = get_formdata('#setting');
$.ajax({
url: '/' + package_name + '/ajax/' + sub + '/setting_save',
type: "POST",
cache: false,
data: formData,
dataType: "json",
success: function (ret) {
if (ret) {
$.notify('<strong>시스템 변수를 저장하였습니다.</strong>', {
type: 'success'
});
} else {
$.notify('<strong>시스템 변수 저장에 실패하였습니다.</strong>', {
type: 'warning'
});
}
}
});
});
$("body").on('click', '#shutdown_btn', function(e){
e.preventDefault();
shutdown_confirm();
});
$("body").on('click', '#celery_test_btn', function(e){
e.preventDefault();
$.ajax({
url: '/' + package_name + '/ajax/' + sub + '/celery_test',
type: "POST",
cache: false,
data: {},
dataType: "json",
success: function (ret) {
if (ret.ret == 'success') {
$.notify('<strong>'+ ret.data+'</strong>', {
type: 'success'
});
} else if (ret.ret == 'timeout' || ret.ret == 'no_celery') {
$.notify('<strong>'+ ret.data+'</strong>', {
type: 'warning'
});
}
//m_modal(ret)
}
});
});
$("body").on('click', '#ps_btn', function(e){
e.preventDefault();
$.ajax({
url: '/' + package_name + '/ajax/' + sub + '/ps',
type: "POST",
cache: false,
data: {},
dataType: "json",
success: function (ret) {
}
});
});
$("body").on('click', '#worker_start_btn', function(e){
e.preventDefault();
$.ajax({
url: '/' + package_name + '/ajax/' + sub + '/worker_start',
type: "POST",
cache: false,
data: {},
dataType: "json",
success: function (ret) {
if (ret.ret == 'success') {
$.notify('<strong>'+ ret.data+'</strong>', {
type: 'success'
});
} else if (ret.ret == 'timeout' || ret.ret == 'no_celery' || ret.ret == 'not_registered') {
$.notify('<strong>'+ ret.data+'</strong>', {
type: 'warning'
});
}
//m_modal(ret)
}
});
});
</script>
{% endblock %}

View File

@@ -0,0 +1,31 @@
{% extends "base.html" %}
{% block content %}
<div>
{{ macros.m_button_group([['saveBtn', '파일 저장']])}}
{{ macros.m_row_start('5') }}
{{ macros.m_row_end() }}
{{ macros.m_hr() }}
{{ macros.info_text_and_buttons('export_filepath', '파일 위치', [['globalEditBtn', '편집기에서 열기', [('file',arg['export_filepath'])]]], value=arg['export_filepath']) }}
{{ macros.setting_input_textarea('export', 'export.sh', desc=['',
'도커를 재시작하거나 flaskfarm.sh 스크립트를 재시작해야 적용됩니다.',
'구동 환경에 따라 사용하는 변수가 다릅니다.',
'',
'REDIS_PORT : celery에서 사용하는 redis port.',
'CELERY_WORKER_COUNT : celery 작업 프로세스 개수.',
'UPDATE_STOP : true인 경우 앱과 플러그인을 업데이트 하지 않음',
'DOCKER_NONSTOP : true인 경우 App이 종료되어서 도커가 중단되지 않음. 개발시 사용',
'PLUGIN_UPDATE_FROM_PYTHON : false인 경우 shell에서 업데이트 실행. true인 경우 앱에서 업데이트 실행.',
],
value=arg['export.sh'], row='20') }}
</div>
<script type="text/javascript">
$("body").on('click', '#saveBtn', function(e){
e.preventDefault();
globalSendCommand('export_save', $('#export').val());
});
</script>
{% endblock %}

View File

@@ -0,0 +1,27 @@
{% extends "base.html" %}
{% block content %}
<div>
{{ macros.m_button_group([['saveBtn', '파일 저장']])}}
{{ macros.m_row_start('5') }}
{{ macros.m_row_end() }}
{{ macros.m_hr() }}
{{ macros.info_text_and_buttons('menu_yaml_filepath', '파일 위치', [['globalEditBtn', '편집기에서 열기', [('file',arg['menu_yaml_filepath'])]]], value=arg['menu_yaml_filepath']) }}
{{ macros.setting_input_textarea('menu', 'menu.yaml', desc=['',
'uri 값',
'플러그인 : 패키지 이름',
'바로가기 : http로 시작하는 링크. 기본값은 새창에서 열기. target: "__self" 값이 있는 경우 기본창',
'구분선 : -',
],
value=arg['menu.yaml'], row='30') }}
</div>
<script type="text/javascript">
$("body").on('click', '#saveBtn', function(e){
e.preventDefault();
globalSendCommand('menu_save', $('#menu').val());
});
</script>
{% endblock %}

View File

@@ -1,10 +1,10 @@
{% extends "base.html" %}
{% block content %}
<div>
{{ macros.m_button_group([['globalSettingSaveBtn', '설정 저장']])}}
{{ macros.m_row_start('5') }}
{{ macros.m_row_end() }}
{{ macros.m_hr() }}
<nav>
{{ macros.m_tab_head_start() }}
{{ macros.m_tab_head2('basic', 'Basic', true) }}
@@ -33,7 +33,7 @@
{{ macros.m_tab_content_start('advanced', false) }}
{{ macros.setting_checkbox('notify_advaned_use', '사용', value=arg['notify_advaned_use'], desc=['충분히 내용 숙지하고 사용하세요.', '사용시 기본설정은 무시됩니다.']) }}
<div id="notify_advaned_use_div" class="collapse">
{{ macros.setting_input_textarea('notify_advaned_policy', '정책', value=arg['notify_advaned_policy'], row='30') }}
{{ macros.setting_input_textarea('_notify_advaned_policy', '정책', value=arg['notify_advaned_policy'], row='30') }}
{{ macros.setting_input_text_and_buttons('tmp_text_advanced', 'Test', [['tmp_advanced_test_btn', '전송']], value='테스트 메시지입니다.', col='9', desc=['메시지 ID = 형식', '형식의 구분자 |', '텔레그램 : bot_token,chat_id | 디스코드 : 웹훅 URL', '예) DEFAULT = 794150118:AAEAAAAAAAAAAAAAAA,186485141|https://discordapp.com/api/webhooks/626295849....', '모든 알림을 텔레그램과 디스코드에 보냄']) }}
{{ macros.setting_input_text('tmp_message_id', 'Test Message ID', value='DEFAULT') }}
</div>