From d6768ec0f8af7f50b06061cd6e0a96cf710085e1 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Wed, 5 Dec 2018 18:46:45 +0800 Subject: [PATCH] u --- .gitignore | 1 + plugins/openresty/index.html | 4 +- plugins/openresty/js/openresty.js | 66 +++++++++++++++++++++++++++++++ plugins/redis/js/redis.js | 4 +- static/app/public.js | 26 +++++++++++- vhost/nginx/phpfpm_status.conf | 49 +++++++++++++++++++++++ 6 files changed, 145 insertions(+), 5 deletions(-) create mode 100644 vhost/nginx/phpfpm_status.conf diff --git a/.gitignore b/.gitignore index e114e2992..00e6e8afd 100644 --- a/.gitignore +++ b/.gitignore @@ -111,3 +111,4 @@ data/json/index.json *.swp *.zip data/*.db +data/control.conf diff --git a/plugins/openresty/index.html b/plugins/openresty/index.html index 6d79dac18..8b1a6c01c 100755 --- a/plugins/openresty/index.html +++ b/plugins/openresty/index.html @@ -1,8 +1,8 @@
-

服务

-

配置修改

+

服务

+

配置修改

负载状态

diff --git a/plugins/openresty/js/openresty.js b/plugins/openresty/js/openresty.js index e676177eb..d74695b91 100755 --- a/plugins/openresty/js/openresty.js +++ b/plugins/openresty/js/openresty.js @@ -332,3 +332,69 @@ function openrestyService(){ },'json'); } openrestyService(); + + + +//配置修改 --- start +function openrestyConfig(type){ + + var con = '

提示:Ctrl+F 搜索关键字,Ctrl+G 查找下一个,Ctrl+S 保存,Ctrl+Shift+R 查找替换!

\ + \ +
    \ +
  • 此处为redis主配置文件,若您不了解配置规则,请勿随意修改。
  • \ +
'; + $(".soft-man-con").html(con); + + var loadT = layer.msg('配置文件路径获取中...',{icon:16,time:0,shade: [0.3, '#000']}); + $.post('/plugins/run', {name:'redis', func:'conf'},function (data) { + layer.close(loadT); + + var loadT2 = layer.msg('文件内容获取中...',{icon:16,time:0,shade: [0.3, '#000']}); + var fileName = data.data; + $.post('/files/get_body', 'path=' + fileName, function(rdata) { + layer.close(loadT2); + if (!rdata.status){ + layer.msg(rdata.msg,{icon:0,time:2000,shade: [0.3, '#000']}); + return; + } + $("#textBody").empty().text(rdata.data.data); + $(".CodeMirror").remove(); + var editor = CodeMirror.fromTextArea(document.getElementById("textBody"), { + extraKeys: { + "Ctrl-Space": "autocomplete", + "Ctrl-F": "findPersistent", + "Ctrl-H": "replaceAll", + "Ctrl-S": function() { + redisConfSafe(fileName); + } + }, + lineNumbers: true, + matchBrackets:true, + }); + editor.focus(); + $(".CodeMirror-scroll").css({"height":"300px","margin":0,"padding":0}); + $("#OnlineEditFileBtn").click(function(){ + $("#textBody").text(editor.getValue()); + openrestyConfSave(fileName); + }); + },'json'); + },'json'); +} + + +//配置保存 +function openrestyConfSave(fileName) { + var data = encodeURIComponent($("#textBody").val()); + var encoding = 'utf-8'; + var loadT = layer.msg('保存中...', { + icon: 16, + time: 0 + }); + $.post('/files/save_body', 'data=' + data + '&path=' + fileName + '&encoding=' + encoding, function(rdata) { + layer.close(loadT); + layer.msg(rdata.msg, { + icon: rdata.status ? 1 : 2 + }); + },'json'); +} +//配置修改 --- end diff --git a/plugins/redis/js/redis.js b/plugins/redis/js/redis.js index 27fb2cf7f..3c70f06f6 100755 --- a/plugins/redis/js/redis.js +++ b/plugins/redis/js/redis.js @@ -109,14 +109,14 @@ function redisConfig(type){ $(".CodeMirror-scroll").css({"height":"300px","margin":0,"padding":0}); $("#OnlineEditFileBtn").click(function(){ $("#textBody").text(editor.getValue()); - redisConfSafe(fileName); + redisConfSave(fileName); }); },'json'); },'json'); } //配置保存 -function redisConfSafe(fileName) { +function redisConfSave(fileName) { var data = encodeURIComponent($("#textBody").val()); var encoding = 'utf-8'; var loadT = layer.msg('保存中...', { diff --git a/static/app/public.js b/static/app/public.js index dd3440dc0..80e266aa6 100755 --- a/static/app/public.js +++ b/static/app/public.js @@ -1465,4 +1465,28 @@ $(function(){ setInterval(function(){ check_login(); },60000); -}); \ No newline at end of file +}); + + + + +/*** 其中功能,针对插件通过库使用 start ***/ +function pluginService(_name){ + $.post('/plugins/run', {name:_name, func:'status'}, function(data) { + console.log(data); + if(!data.status){ + layer.msg(data.msg,{icon:0,time:3000,shade: [0.3, '#000']}); + return; + } + if (data.data == 'start'){ + setOpenrestyService('openresty', true); + } else { + setOpenrestyService('openresty', false); + } + },'json'); +} + +function pluginSetService(_name ,start){ + +} +/*** 其中功能,针对插件通过库使用 end ***/ \ No newline at end of file diff --git a/vhost/nginx/phpfpm_status.conf b/vhost/nginx/phpfpm_status.conf new file mode 100644 index 000000000..96fbb8209 --- /dev/null +++ b/vhost/nginx/phpfpm_status.conf @@ -0,0 +1,49 @@ +server { + listen 80; + server_name 127.0.0.1; + allow 127.0.0.1; + location /nginx_status { + stub_status on; + access_log off; + } + location /phpfpm_52_status { + fastcgi_pass unix:/tmp/php-cgi-52.sock; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $fastcgi_script_name; + } + location /phpfpm_53_status { + fastcgi_pass unix:/tmp/php-cgi-53.sock; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $fastcgi_script_name; + } + location /phpfpm_54_status { + fastcgi_pass unix:/tmp/php-cgi-54.sock; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $fastcgi_script_name; + } + location /phpfpm_55_status { + fastcgi_pass unix:/tmp/php-cgi-55.sock; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $fastcgi_script_name; + } + location /phpfpm_56_status { + fastcgi_pass unix:/tmp/php-cgi-56.sock; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $fastcgi_script_name; + } + location /phpfpm_70_status { + fastcgi_pass unix:/tmp/php-cgi-70.sock; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $fastcgi_script_name; + } + location /phpfpm_71_status { + fastcgi_pass unix:/tmp/php-cgi-71.sock; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $fastcgi_script_name; + } + location /phpfpm_72_status { + fastcgi_pass unix:/tmp/php-cgi-72.sock; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $fastcgi_script_name; + } +}