updae
This commit is contained in:
43
lib/system/mod_tool.py
Normal file
43
lib/system/mod_tool.py
Normal file
@@ -0,0 +1,43 @@
|
||||
from support import SupportFile
|
||||
|
||||
from .setup import *
|
||||
|
||||
name = 'tool'
|
||||
|
||||
class ModuleTool(PluginModuleBase):
|
||||
db_default = {
|
||||
'path_upload': os.path.join(F.config['path_data'], 'upload'),
|
||||
}
|
||||
|
||||
|
||||
def __init__(self, P):
|
||||
super(ModuleTool, self).__init__(P, name=name, first_menu='celery')
|
||||
|
||||
|
||||
def process_menu(self, page, req):
|
||||
arg = P.ModelSetting.to_dict()
|
||||
try:
|
||||
return render_template(f'{__package__}_{name}_{page}.html', arg=arg)
|
||||
except Exception as e:
|
||||
P.logger.error(f'Exception:{str(e)}')
|
||||
P.logger.error(traceback.format_exc())
|
||||
return render_template('sample.html', title=f"{__package__}/{name}/{page}")
|
||||
|
||||
|
||||
def process_command(self, command, arg1, arg2, arg3, req):
|
||||
ret = {'ret':'success'}
|
||||
if command == 'plugin_install':
|
||||
ret = F.PluginManager.plugin_install(arg1)
|
||||
|
||||
return jsonify(ret)
|
||||
|
||||
|
||||
def plugin_load(self):
|
||||
try:
|
||||
pass
|
||||
except Exception as e:
|
||||
P.logger.error(f'Exception:{str(e)}')
|
||||
P.logger.error(traceback.format_exc())
|
||||
|
||||
|
||||
|
||||
@@ -73,11 +73,11 @@ try:
|
||||
|
||||
SystemModelSetting = P.ModelSetting
|
||||
from .mod_home import ModuleHome
|
||||
from .mod_plugin import ModulePlugin
|
||||
from .mod_route import ModuleRoute
|
||||
from .mod_setting import ModuleSetting
|
||||
|
||||
P.set_module_list([ModuleSetting, ModuleHome, ModuleRoute, ModulePlugin])
|
||||
from .mod_plugin import ModulePlugin
|
||||
from .mod_tool import ModuleTool
|
||||
P.set_module_list([ModuleHome, ModuleRoute, ModuleSetting, ModulePlugin, ModuleTool])
|
||||
|
||||
except Exception as e:
|
||||
P.logger.error(f'Exception:{str(e)}')
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<script type="text/javascript">
|
||||
$("body").on('click', '#select_btn', function(e){
|
||||
e.preventDefault();
|
||||
selectLocalFolder("폴더 선택", $('#plugin_dev_path').val(), function(ret) {
|
||||
globalSelectLocalFolder("폴더 선택", $('#plugin_dev_path').val(), function(ret) {
|
||||
$('#plugin_dev_path').val(ret);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
{{ 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) }}
|
||||
|
||||
@@ -1,112 +0,0 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
|
||||
{{ macros.m_button_group([['yaml_edit_btn', '편집'], ['terminal_open_btn', 'Terminal 실행'], ['all_append_files_show_btn', '모두 확장'], ['all_append_files_hide_btn', '모두 축소']])}}
|
||||
{{ macros.m_row_start('5') }}
|
||||
{{ macros.m_row_end() }}
|
||||
{{ macros.m_hr_head_bottom() }}
|
||||
<div id="list_div"></div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
var package_name = "{{arg['package_name']}}";
|
||||
var sub = "{{arg['sub']}}";
|
||||
var yaml_path = "{{arg['yaml_path']}}";
|
||||
var current_data = null;
|
||||
|
||||
$(document).ready(function(){
|
||||
reqeust_info();
|
||||
});
|
||||
|
||||
function reqeust_info() {
|
||||
$.ajax({
|
||||
url: '/' + package_name + '/ajax/'+sub+'/get_info',
|
||||
type: "POST",
|
||||
cache: false,
|
||||
data:{},
|
||||
dataType: "json",
|
||||
success: function (ret) {
|
||||
make_list(ret);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function make_list(data) {
|
||||
current_data = data;
|
||||
data = data.commands;
|
||||
str = '';
|
||||
str = '<table id="result_table" class="table table-sm tableRowHover " ><thead class="thead-dark"><tr> \
|
||||
<th style="width:10%; text-align:center;">INDEX</th> \
|
||||
<th style="width:80%; text-align:left;">제목</th> \
|
||||
<th style="width:10%; text-align:center;">실행</th> \
|
||||
</tr></thead><tbody id="list">';
|
||||
|
||||
if (data.length == 0) str += '<tr><td colspan="3"><h4>명령이 없습니다.</h4></td></tr>';
|
||||
|
||||
for(i in data) {
|
||||
console.log(data[i]);
|
||||
str += '<tr class="chover" style="cursor: pointer;" data-toggle="collapse" data-target="#collapse_' + i + '" aria-expanded="true" >';
|
||||
str += '<td scope="col" style="width:10%; text-align:center;">'+ (parseInt(i)+1) + '</td>';
|
||||
str += '<td scope="col" style="width:80%; text-align:left;">'+ data[i].title + '</td>';
|
||||
tmp = m_button('terminal_open_btn', '실행', [{'key':'index', 'value':i}]);
|
||||
str += '<td scope="col" style="width:10%; text-align:center;">'+ tmp + '</td>';
|
||||
|
||||
str += '</tr>';
|
||||
|
||||
str += '<tr class="collapse tableRowHoverOff" style="cursor: pointer;" id="collapse_' + i + '">';
|
||||
str += '<td></td><td colspan="2">';
|
||||
str += "<pre>"+data[i].command+"</pre>";
|
||||
|
||||
str += '</td>';
|
||||
str += '</tr>'
|
||||
|
||||
}
|
||||
str += '</table>';
|
||||
document.getElementById("list_div").innerHTML = str;
|
||||
|
||||
return
|
||||
|
||||
}
|
||||
|
||||
$("body").on('click', '#yaml_edit_btn', function(e){
|
||||
url = '/flaskcode' + yaml_path;
|
||||
window.open(url, '_blank')
|
||||
});
|
||||
|
||||
|
||||
|
||||
$("body").on('click', '#terminal_open_btn', function(e){
|
||||
e.preventDefault();
|
||||
index = $(this).data('index');
|
||||
console.log(index);
|
||||
if (index == null) {
|
||||
window.open("/terminal", "_blank");
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: '/' + package_name + '/ajax/' + sub + '/run',
|
||||
type: "POST",
|
||||
cache: false,
|
||||
data: {index:index},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if (data.ret == 'success') {
|
||||
window.open("/terminal", "_blank");
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$("body").on('click', '#all_append_files_show_btn', function(e){
|
||||
e.preventDefault();
|
||||
$('.collapse').collapse('show');
|
||||
|
||||
});
|
||||
|
||||
$("body").on('click', '#all_append_files_hide_btn', function(e){
|
||||
e.preventDefault();
|
||||
$('.collapse').collapse('hide');
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
36
lib/system/templates/system_tool_upload.html
Normal file
36
lib/system/templates/system_tool_upload.html
Normal file
@@ -0,0 +1,36 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<head>
|
||||
{{ dropzone.load_css() }}
|
||||
{{ dropzone.style('border: 2px dashed #0087F7; margin: 10%; min-height: 400px;') }}
|
||||
</head>
|
||||
|
||||
<div>
|
||||
{{ macros.m_button_group([['globalSettingSaveBtn', '설정 저장']])}}
|
||||
{{ macros.m_row_start('5') }}
|
||||
{{ macros.m_row_end() }}
|
||||
{{ macros.m_hr() }}
|
||||
<form id='setting' name='setting'>
|
||||
{{ macros.setting_input_text_and_buttons('path_upload', '업로드 경로', [['select_btn', '폴더 선택']], value=arg['path_upload'], desc=['설정 저장 후부터 적용']) }}
|
||||
</form>
|
||||
{{ macros.m_hr_black() }}
|
||||
{{ dropzone.create(action='upload') }}
|
||||
{{ dropzone.load_js() }}
|
||||
{{ dropzone.config() }}
|
||||
|
||||
<script type="text/javascript">
|
||||
$("body").on('click', '#select_btn', function(e){
|
||||
e.preventDefault();
|
||||
globalSelectLocalFolder("업로드 폴더 선택", $('#path_upload').val(), function(ret) {
|
||||
$('#path_upload').val(ret);
|
||||
});
|
||||
});
|
||||
|
||||
$("body").on('click', '#plugin_install_btn', function(e){
|
||||
e.preventDefault();
|
||||
globalSendCommand('plugin_install', $('#_plugin_git').val());
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user