update
This commit is contained in:
@@ -16,6 +16,7 @@ class PluginManager:
|
|||||||
plugin_list = {}
|
plugin_list = {}
|
||||||
plugin_menus = {}
|
plugin_menus = {}
|
||||||
setting_menus = []
|
setting_menus = []
|
||||||
|
all_package_list = {}
|
||||||
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -29,11 +30,10 @@ class PluginManager:
|
|||||||
plugins = os.listdir(plugin_path)
|
plugins = os.listdir(plugin_path)
|
||||||
"""
|
"""
|
||||||
plugins = []
|
plugins = []
|
||||||
pass_include = []
|
|
||||||
except_plugin_list = []
|
|
||||||
|
|
||||||
#2019-07-17
|
#2019-07-17
|
||||||
if F.config.get('plugin_loading_only_devpath', None) != True:
|
|
||||||
try:
|
try:
|
||||||
plugin_path = os.path.join(F.config['path_data'], 'plugins')
|
plugin_path = os.path.join(F.config['path_data'], 'plugins')
|
||||||
if os.path.exists(plugin_path) == True and os.path.isdir(plugin_path) == True:
|
if os.path.exists(plugin_path) == True and os.path.isdir(plugin_path) == True:
|
||||||
@@ -43,12 +43,16 @@ class PluginManager:
|
|||||||
for t in tmps:
|
for t in tmps:
|
||||||
if not t.startswith('_') and os.path.isdir(os.path.join(plugin_path, t)):
|
if not t.startswith('_') and os.path.isdir(os.path.join(plugin_path, t)):
|
||||||
add_plugin_list.append(t)
|
add_plugin_list.append(t)
|
||||||
|
cls.all_package_list[t] = {'pos':'normal', 'path':os.path.join(plugin_path, t)}
|
||||||
|
|
||||||
plugins = plugins + add_plugin_list
|
plugins = plugins + add_plugin_list
|
||||||
pass_include = pass_include + add_plugin_list
|
|
||||||
except Exception as exception:
|
except Exception as exception:
|
||||||
F.logger.error('Exception:%s', exception)
|
F.logger.error('Exception:%s', exception)
|
||||||
F.logger.error(traceback.format_exc())
|
F.logger.error(traceback.format_exc())
|
||||||
|
|
||||||
|
if F.config.get('plugin_loading_only_devpath', None) == True:
|
||||||
|
plugins = []
|
||||||
|
|
||||||
# 2018-09-04
|
# 2018-09-04
|
||||||
try:
|
try:
|
||||||
plugin_path = F.SystemModelSetting.get('plugin_dev_path')
|
plugin_path = F.SystemModelSetting.get('plugin_dev_path')
|
||||||
@@ -60,8 +64,8 @@ class PluginManager:
|
|||||||
for t in tmps:
|
for t in tmps:
|
||||||
if not t.startswith('_') and os.path.isdir(os.path.join(plugin_path, t)):
|
if not t.startswith('_') and os.path.isdir(os.path.join(plugin_path, t)):
|
||||||
add_plugin_list.append(t)
|
add_plugin_list.append(t)
|
||||||
|
cls.all_package_list[t] = {'pos':'dev', 'path':os.path.join(plugin_path, t)}
|
||||||
plugins = plugins + add_plugin_list
|
plugins = plugins + add_plugin_list
|
||||||
pass_include = pass_include + add_plugin_list
|
|
||||||
except Exception as exception:
|
except Exception as exception:
|
||||||
F.logger.error('Exception:%s', exception)
|
F.logger.error('Exception:%s', exception)
|
||||||
F.logger.error(traceback.format_exc())
|
F.logger.error(traceback.format_exc())
|
||||||
@@ -74,6 +78,9 @@ class PluginManager:
|
|||||||
for _ in plugins:
|
for _ in plugins:
|
||||||
if _ in plugin_loading_list:
|
if _ in plugin_loading_list:
|
||||||
new_plugins.append(_)
|
new_plugins.append(_)
|
||||||
|
else:
|
||||||
|
cls.all_package_list[t]['loading'] = False
|
||||||
|
cls.all_package_list[t]['status'] = 'not_include_loading_list'
|
||||||
plugins = new_plugins
|
plugins = new_plugins
|
||||||
except Exception as exception:
|
except Exception as exception:
|
||||||
F.logger.error('Exception:%s', exception)
|
F.logger.error('Exception:%s', exception)
|
||||||
@@ -87,12 +94,17 @@ class PluginManager:
|
|||||||
for _ in plugins:
|
for _ in plugins:
|
||||||
if _ not in plugin_except_list:
|
if _ not in plugin_except_list:
|
||||||
new_plugins.append(_)
|
new_plugins.append(_)
|
||||||
|
else:
|
||||||
|
cls.all_package_list[t]['loading'] = False
|
||||||
|
cls.all_package_list[t]['status'] = 'include_except_list'
|
||||||
plugins = new_plugins
|
plugins = new_plugins
|
||||||
except Exception as exception:
|
except Exception as exception:
|
||||||
F.logger.error('Exception:%s', exception)
|
F.logger.error('Exception:%s', exception)
|
||||||
F.logger.error(traceback.format_exc())
|
F.logger.error(traceback.format_exc())
|
||||||
return plugins
|
return plugins
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# menu, blueprint, plugin_info, plugin_load, plugin_unload
|
# menu, blueprint, plugin_info, plugin_load, plugin_unload
|
||||||
@classmethod
|
@classmethod
|
||||||
def plugin_init(cls):
|
def plugin_init(cls):
|
||||||
@@ -112,7 +124,8 @@ class PluginManager:
|
|||||||
# F.logger.debug('Except plugin : %s' % frame.plugin_menu)
|
# F.logger.debug('Except plugin : %s' % frame.plugin_menu)
|
||||||
# continue
|
# continue
|
||||||
F.logger.debug(f'[+] PLUGIN LOADING Start.. [{plugin_name}]')
|
F.logger.debug(f'[+] PLUGIN LOADING Start.. [{plugin_name}]')
|
||||||
entity = {'version':'3'}
|
entity = cls.all_package_list[plugin_name]
|
||||||
|
entity['version'] = '3'
|
||||||
try:
|
try:
|
||||||
mod = __import__('%s' % (plugin_name), fromlist=[])
|
mod = __import__('%s' % (plugin_name), fromlist=[])
|
||||||
mod_plugin_info = None
|
mod_plugin_info = None
|
||||||
@@ -166,7 +179,6 @@ class PluginManager:
|
|||||||
entity['P'] = getattr(mod, 'P')
|
entity['P'] = getattr(mod, 'P')
|
||||||
mod_blue_print = getattr(entity['P'], 'blueprint')
|
mod_blue_print = getattr(entity['P'], 'blueprint')
|
||||||
if mod_blue_print:
|
if mod_blue_print:
|
||||||
#if plugin_name in pass_include or is_include_menu(plugin_name):
|
|
||||||
F.app.register_blueprint(mod_blue_print)
|
F.app.register_blueprint(mod_blue_print)
|
||||||
except Exception as exception:
|
except Exception as exception:
|
||||||
#logger.error('Exception:%s', exception)
|
#logger.error('Exception:%s', exception)
|
||||||
@@ -179,6 +191,9 @@ class PluginManager:
|
|||||||
F.logger.error('Exception:%s', exception)
|
F.logger.error('Exception:%s', exception)
|
||||||
F.logger.error(traceback.format_exc())
|
F.logger.error(traceback.format_exc())
|
||||||
F.logger.debug('no blueprint')
|
F.logger.debug('no blueprint')
|
||||||
|
cls.all_package_list[plugin_name]['loading'] = False
|
||||||
|
cls.all_package_list[plugin_name]['status'] = 'import fail'
|
||||||
|
cls.all_package_list[plugin_name]['log'] = traceback.format_exc()
|
||||||
|
|
||||||
#from tool_base import d
|
#from tool_base import d
|
||||||
#logger.error(d(system.LogicPlugin.current_loading_plugin_list))
|
#logger.error(d(system.LogicPlugin.current_loading_plugin_list))
|
||||||
@@ -227,7 +242,6 @@ class PluginManager:
|
|||||||
mod_plugin_load = getattr(entity['module'], 'plugin_load')
|
mod_plugin_load = getattr(entity['module'], 'plugin_load')
|
||||||
elif entity['version'] == '4':
|
elif entity['version'] == '4':
|
||||||
mod_plugin_load = getattr(entity['P'], 'plugin_load')
|
mod_plugin_load = getattr(entity['P'], 'plugin_load')
|
||||||
#if mod_plugin_load and (key in pass_include or is_include_menu(key)):
|
|
||||||
if mod_plugin_load:
|
if mod_plugin_load:
|
||||||
def func(mod_plugin_load, key):
|
def func(mod_plugin_load, key):
|
||||||
try:
|
try:
|
||||||
@@ -239,6 +253,9 @@ class PluginManager:
|
|||||||
F.logger.error('### plugin_load exception : %s', key)
|
F.logger.error('### plugin_load exception : %s', key)
|
||||||
F.logger.error('Exception:%s', exception)
|
F.logger.error('Exception:%s', exception)
|
||||||
F.logger.error(traceback.format_exc())
|
F.logger.error(traceback.format_exc())
|
||||||
|
cls.all_package_list[key]['loading'] = False
|
||||||
|
cls.all_package_list[key]['status'] = 'plugin_load error'
|
||||||
|
cls.all_package_list[key]['log'] = traceback.format_exc()
|
||||||
# mod는 위에서 로딩
|
# mod는 위에서 로딩
|
||||||
if key != 'mod':
|
if key != 'mod':
|
||||||
t = threading.Thread(target=func, args=(mod_plugin_load, key))
|
t = threading.Thread(target=func, args=(mod_plugin_load, key))
|
||||||
@@ -258,7 +275,7 @@ class PluginManager:
|
|||||||
elif entity['version'] == '4':
|
elif entity['version'] == '4':
|
||||||
mod_menu = getattr(entity['P'], 'menu')
|
mod_menu = getattr(entity['P'], 'menu')
|
||||||
|
|
||||||
if mod_menu:# and (key in pass_include or is_include_menu(key)):
|
if mod_menu:
|
||||||
cls.plugin_menus[key]= {'menu':mod_menu, 'match':False}
|
cls.plugin_menus[key]= {'menu':mod_menu, 'match':False}
|
||||||
if entity['version'] == '4':
|
if entity['version'] == '4':
|
||||||
setting_menu = getattr(entity['P'], 'setting_menu')
|
setting_menu = getattr(entity['P'], 'setting_menu')
|
||||||
|
|||||||
@@ -81,8 +81,8 @@ function m_col(w, h, align='left') {
|
|||||||
return str
|
return str
|
||||||
}
|
}
|
||||||
|
|
||||||
function m_col2(w, h, align='left') {
|
function m_col_wide(w, h, align='left') {
|
||||||
var str = '<div class="col-sm-' + w + ' " style="padding:5px; margin:0px; text-align: '+align+'; word-break:break-all;">';
|
var str = '<div class="col-sm-' + w + ' " style="padding:0px; margin:0px; text-align: '+align+'; word-break:break-all;">';
|
||||||
str += h
|
str += h
|
||||||
str += '</div>';
|
str += '</div>';
|
||||||
return str
|
return str
|
||||||
@@ -105,6 +105,15 @@ function m_button(id, text, data) {
|
|||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function m_button_small(id, text, data, color='danger') {
|
||||||
|
var str = '<button id="'+id+'" name="'+id+'" class="btn btn-sm btn-'+color+' py-0" style="font-size: 0.8em;" '
|
||||||
|
for ( var i in data) {
|
||||||
|
str += ' data-' + data[i].key + '="' + data[i].value+ '" '
|
||||||
|
}
|
||||||
|
str += '>' + text + '</button>';
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
function m_button2(id, text, data, outline_color) {
|
function m_button2(id, text, data, outline_color) {
|
||||||
var str = '<button id="'+id+'" name="'+id+'" class="btn btn-sm btn-outline-'+outline_color+'" '
|
var str = '<button id="'+id+'" name="'+id+'" class="btn btn-sm btn-outline-'+outline_color+'" '
|
||||||
for ( var i in data) {
|
for ( var i in data) {
|
||||||
|
|||||||
@@ -790,6 +790,10 @@ macros.setting_button_with_info([['toggle_btn', 'Toggle', [{'key':'category', 'v
|
|||||||
<div class="col-sm-{{width}}" style="text-align:{{align}}; word-break:break-all;">{{html}}</div>
|
<div class="col-sm-{{width}}" style="text-align:{{align}}; word-break:break-all;">{{html}}</div>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
|
{% macro m_col_wide(width, html, align='left') %}
|
||||||
|
<div class="col-sm-{{width}}" style="padding:0px; margin:0px; text-align:{{align}}; word-break:break-all;">{{html}}</div>
|
||||||
|
{% endmacro %}
|
||||||
|
|
||||||
{% macro m_strong(html) %}
|
{% macro m_strong(html) %}
|
||||||
<strong>{{html}}</strong>
|
<strong>{{html}}</strong>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
def d(data):
|
def d(data):
|
||||||
if type(data) in [type({}), type([])]:
|
if type(data) in [type({}), type([])]:
|
||||||
import json
|
import json
|
||||||
|
try:
|
||||||
return '\n' + json.dumps(data, indent=4, ensure_ascii=False)
|
return '\n' + json.dumps(data, indent=4, ensure_ascii=False)
|
||||||
|
except:
|
||||||
|
return data
|
||||||
else:
|
else:
|
||||||
return str(data)
|
return str(data)
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import shutil
|
||||||
|
|
||||||
from support import SupportFile
|
from support import SupportFile
|
||||||
|
|
||||||
from .setup import *
|
from .setup import *
|
||||||
@@ -27,7 +29,40 @@ class ModulePlugin(PluginModuleBase):
|
|||||||
ret = {'ret':'success'}
|
ret = {'ret':'success'}
|
||||||
if command == 'plugin_install':
|
if command == 'plugin_install':
|
||||||
ret = F.PluginManager.plugin_install(arg1)
|
ret = F.PluginManager.plugin_install(arg1)
|
||||||
|
elif command == 'get_plugin_list':
|
||||||
|
data = []
|
||||||
|
"""
|
||||||
|
for name, entity in F.PluginManager.plugin_list.items():
|
||||||
|
if entity['version'] == '3':
|
||||||
|
data.append({'package_name':name})
|
||||||
|
else:
|
||||||
|
data.append(entity['P'].plugin_info)
|
||||||
|
"""
|
||||||
|
for name, entity in F.PluginManager.all_package_list.items():
|
||||||
|
if entity['version'] == '3':
|
||||||
|
#data.append(entity)
|
||||||
|
data.append({'package_name':name})
|
||||||
|
else:
|
||||||
|
data.append(entity['P'].plugin_info)
|
||||||
|
data[-1]['loading'] = entity.get('loading')
|
||||||
|
data[-1]['status'] = entity.get('status')
|
||||||
|
data[-1]['log'] = entity.get('log')
|
||||||
|
ret['data'] = data
|
||||||
|
#P.logger.debug(data)
|
||||||
|
elif command == 'uninstall':
|
||||||
|
info = F.PluginManager.all_package_list[arg1]
|
||||||
|
if os.path.exists(info['path']):
|
||||||
|
try:
|
||||||
|
shutil.rmtree(info['path'])
|
||||||
|
ret['msg'] = '삭제하였습니다.<br>재시작시 적용됩니다.'
|
||||||
|
except Exception as e:
|
||||||
|
P.logger.error(f'Exception:{str(e)}')
|
||||||
|
P.logger.error(traceback.format_exc())
|
||||||
|
ret['msg'] = info['path'] + "<br>삭제에 실패하였습니다.<br>" + str(e)
|
||||||
|
ret['ret'] = 'danger'
|
||||||
|
else:
|
||||||
|
ret['msg'] = info['path'] + "<br>폴더가 없습니다."
|
||||||
|
ret['ret'] = 'danger'
|
||||||
return jsonify(ret)
|
return jsonify(ret)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -20,11 +20,10 @@ __menu = {
|
|||||||
'uri': 'plugin',
|
'uri': 'plugin',
|
||||||
'name': '플러그인',
|
'name': '플러그인',
|
||||||
'list': [
|
'list': [
|
||||||
{'uri': 'setting', 'name': '개발 설정'},
|
{'uri': 'setting', 'name': '설정'},
|
||||||
{'uri': 'list', 'name': '플러그인 목록'},
|
{'uri': 'list', 'name': '로딩 플러그인'},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
'uri': 'tool',
|
'uri': 'tool',
|
||||||
'name': '시스템 툴',
|
'name': '시스템 툴',
|
||||||
@@ -73,9 +72,9 @@ try:
|
|||||||
|
|
||||||
SystemModelSetting = P.ModelSetting
|
SystemModelSetting = P.ModelSetting
|
||||||
from .mod_home import ModuleHome
|
from .mod_home import ModuleHome
|
||||||
|
from .mod_plugin import ModulePlugin
|
||||||
from .mod_route import ModuleRoute
|
from .mod_route import ModuleRoute
|
||||||
from .mod_setting import ModuleSetting
|
from .mod_setting import ModuleSetting
|
||||||
from .mod_plugin import ModulePlugin
|
|
||||||
from .mod_tool import ModuleTool
|
from .mod_tool import ModuleTool
|
||||||
P.set_module_list([ModuleHome, ModuleRoute, ModuleSetting, ModulePlugin, ModuleTool])
|
P.set_module_list([ModuleHome, ModuleRoute, ModuleSetting, ModulePlugin, ModuleTool])
|
||||||
|
|
||||||
|
|||||||
@@ -8,149 +8,107 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<nav>
|
|
||||||
{{ macros.m_tab_head_start() }}
|
|
||||||
{{ macros.m_tab_head2('normal', '일반', false) }}
|
|
||||||
{{ macros.m_tab_head2('list', '플러그인 목록', true) }}
|
|
||||||
{{ macros.m_tab_head_end() }}
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<div class="tab-content" id="nav-tabContent">
|
|
||||||
|
|
||||||
{{ macros.m_tab_content_start('normal', false) }}
|
|
||||||
<form id='setting' name='setting'>
|
|
||||||
{{ macros.setting_input_text('plugin_dev_path', '개발용 플러그인 경로', value=arg['plugin_dev_path'], desc=['플러그인을 개발할 때 사용하는 경로'], col='9') }}
|
|
||||||
{{ macros.setting_button([['setting_save', '저장']]) }}
|
|
||||||
|
|
||||||
</form>
|
|
||||||
</form>
|
|
||||||
{{ macros.m_tab_content_end() }}
|
|
||||||
|
|
||||||
{{ macros.m_tab_content_start('list', true) }}
|
|
||||||
{{ macros.setting_input_text_and_buttons('plugin_git', '플러그인 수동 설치', [['plugin_install_btn', '설치']], value='https://github.com/', desc=['SJVA.ME 플러그인 게시판에 있는 링크 주소를 입력하세요.']) }}
|
|
||||||
|
|
||||||
{{ macros.m_hr_head_top() }}
|
{{ macros.m_hr_head_top() }}
|
||||||
{{ macros.m_row_start('0') }}
|
{{ macros.m_row_start('0') }}
|
||||||
{{ macros.m_col(3, macros.m_strong('Name')) }}
|
{{ macros.m_col_wide(1, macros.m_strong('Idx'), 'center') }}
|
||||||
{{ macros.m_col(1, macros.m_strong('Dev.')) }}
|
{{ macros.m_col_wide(2, macros.m_strong('Title')) }}
|
||||||
{{ macros.m_col(1, macros.m_strong('Category')) }}
|
{{ macros.m_col_wide(2, macros.m_strong('Package Name')) }}
|
||||||
{{ macros.m_col(1, macros.m_strong('Version')) }}
|
{{ macros.m_col_wide(1, macros.m_strong('Dev.')) }}
|
||||||
{{ macros.m_col(6, macros.m_strong('Description')) }}
|
{{ macros.m_col_wide(1, macros.m_strong('Version')) }}
|
||||||
|
{{ macros.m_col_wide(5, macros.m_strong('Description')) }}
|
||||||
{{ macros.m_row_end() }}
|
{{ macros.m_row_end() }}
|
||||||
{{ macros.m_hr_head_bottom() }}
|
{{ macros.m_hr_head_bottom() }}
|
||||||
<div id="plugin_list_div"></div>
|
<div id="plugin_list_div"></div>
|
||||||
{{ macros.m_tab_content_end() }}
|
</div>
|
||||||
</div><!--tab-content-->
|
|
||||||
</div> <!--전체-->
|
|
||||||
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var package_name = 'system';
|
|
||||||
var current_data;
|
|
||||||
var install = "{{arg['install']}}";
|
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
$.ajax({
|
globalSendCommand('get_plugin_list', null, null, null, null, function(data){
|
||||||
url: '/' + package_name + '/ajax/plugin_list',
|
make_plugin_list(data.data);
|
||||||
type: "POST",
|
|
||||||
cache: false,
|
|
||||||
data: {},
|
|
||||||
dataType: "json",
|
|
||||||
success: function (data) {
|
|
||||||
current_data = data
|
|
||||||
make_plugin_list();
|
|
||||||
if (install != '') {
|
|
||||||
$('#plugin_git').val(install);
|
|
||||||
//notify('플러그인이 설치되어 있지 않습니다.', 'danger');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
//설정 저장
|
function make_plugin_list(data) {
|
||||||
$("#setting_save").click(function(e) {
|
current_data = data;
|
||||||
e.preventDefault();
|
console.log(data);
|
||||||
var formData = get_formdata('#setting');
|
|
||||||
setting_save_func(formData, true)
|
|
||||||
//
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
function setting_save_func(formData, noti) {
|
|
||||||
$.ajax({
|
|
||||||
url: '/' + package_name + '/ajax/setting_save',
|
|
||||||
type: "POST",
|
|
||||||
cache: false,
|
|
||||||
data: formData,
|
|
||||||
dataType: "json",
|
|
||||||
success: function (ret) {
|
|
||||||
if (ret) {
|
|
||||||
if (noti) {
|
|
||||||
$.notify('<strong>설정을 저장하였습니다.</strong>', {
|
|
||||||
type: 'success'
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
window.location.href = "/"
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$.notify('<strong>설정 저장에 실패하였습니다.</strong>', {
|
|
||||||
type: 'warning'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function make_plugin_list() {
|
|
||||||
str = ''
|
str = ''
|
||||||
console.log(current_data)
|
console.log(data)
|
||||||
for (i in current_data) {
|
for (i in data) {
|
||||||
console.log(i)
|
console.log(data[i]);
|
||||||
console.log(current_data[i])
|
|
||||||
str += m_row_start();
|
str += m_row_start();
|
||||||
str += m_col(3, i)
|
str += m_col_wide(1, (parseInt(i)+1), 'center')
|
||||||
|
if (data[i].title == null) {
|
||||||
|
str += m_col_wide(2, '');
|
||||||
|
str += m_col_wide(2, data[i].package_name);
|
||||||
|
str += m_col_wide(5, '');
|
||||||
|
tmp = m_button_small('uninstall_btn', '삭제', [{'key':'package_name', 'value':data[i].package_name}]);
|
||||||
|
} else {
|
||||||
|
str += m_col_wide(2, data[i].title);
|
||||||
|
|
||||||
|
str += m_col_wide(2, data[i].package_name);
|
||||||
|
str += m_col_wide(1, data[i].developer);
|
||||||
|
str += m_col_wide(1, data[i].version);
|
||||||
|
if (data[i].loading == false) {
|
||||||
|
tmp = data[i].description + '<br>' + text_color('[로딩 실패] ') + data[i].status;
|
||||||
|
str += m_col_wide(3, tmp);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
str += m_col_wide(3, data[i].description);
|
||||||
|
}
|
||||||
|
|
||||||
if (current_data[i].info != null) {
|
|
||||||
str += m_col(1, current_data[i].info.developer);
|
|
||||||
str += m_col(1, current_data[i].info.category);
|
|
||||||
str += m_col(1, current_data[i].info.version);
|
|
||||||
tmp = ''
|
tmp = ''
|
||||||
tmp += m_button('plugin_uninstall_btn', '삭제', [{'key':'plugin_name', 'value':current_data[i].info.name}]);
|
|
||||||
if (current_data[i].info.local_info != null) {
|
|
||||||
tmp += m_button('global_link_btn', 'GIT', [{'key':'url', 'value':current_data[i].info.local_info.home}]);
|
|
||||||
if (current_data[i].info.local_info.home != current_data[i].info.local_info.more && current_data[i].info.local_info.more.startsWith('http'))
|
|
||||||
tmp += m_button('global_link_btn', 'MORE', [{'key':'url', 'value':current_data[i].info.local_info.more}]);
|
|
||||||
}
|
|
||||||
|
|
||||||
tmp = m_button_group(tmp)
|
tmp += m_button_small('globalOpenBtn', '홈페이지', [{'key':'url', 'value':data[i].home}], 'primary');
|
||||||
str += m_col(6, current_data[i].info.description +'<br><br>'+ tmp)
|
tmp += m_button_small('uninstall_btn', '삭제', [{'key':'package_name', 'value':data[i].package_name}, {'key':'title', 'value':data[i].title}]);
|
||||||
|
tmp += m_button_small('json_btn', 'JSON', [{'key':'idx', 'value':i}], 'info');
|
||||||
}
|
}
|
||||||
|
tmp = m_button_group(tmp)
|
||||||
|
str += m_col_wide(2, tmp, 'right')
|
||||||
str += m_row_end();
|
str += m_row_end();
|
||||||
if (i != current_data.length -1) str += m_hr(0);
|
if (i != current_data.length -1) str += m_hr(0);
|
||||||
}
|
}
|
||||||
document.getElementById("plugin_list_div").innerHTML = str;
|
document.getElementById("plugin_list_div").innerHTML = str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$("body").on('click', '#json_btn', function(e){
|
||||||
|
|
||||||
$("body").on('click', '#plugin_install_btn', function(e){
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
plugin_git = document.getElementById("plugin_git").value
|
item_id = $(this).data('idx');
|
||||||
|
m_modal(current_data[item_id]);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$("body").on('click', '#uninstall_btn', function(e){
|
||||||
|
e.preventDefault();
|
||||||
|
$("#confirm_title").html("삭제 확인");
|
||||||
|
$("#confirm_body").html($(this).data('title') + " 플러그인을 삭제 하시겠습니까?");
|
||||||
|
package_name = $(this).data('package_name');
|
||||||
|
$('#confirm_button').attr('onclick', "javascript:uninstall(package_name);");
|
||||||
|
$("#confirm_modal").modal();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function uninstall(package_name) {
|
||||||
|
globalSendCommand('uninstall', package_name, null, null, null, function(ret) {
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
url: '/' + package_name + '/ajax/plugin_install',
|
|
||||||
type: "POST",
|
|
||||||
cache: false,
|
|
||||||
data:{plugin_git:plugin_git},
|
|
||||||
dataType: "json",
|
|
||||||
success: function (data) {
|
|
||||||
t = (data.ret == 'success') ? 'success' : 'warning'
|
|
||||||
$.notify('<strong>'+data.log+'</strong>', {
|
|
||||||
type: t
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
$("body").on('click', '#plugin_uninstall_btn', function(e){
|
$("body").on('click', '#plugin_uninstall_btn', function(e){
|
||||||
|
|||||||
Reference in New Issue
Block a user