diff --git a/README.md b/README.md index ff7cf5c..e6ced69 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@
-[![](https://img.shields.io/badge/base-openresty-blue?style=flat-square)](https://openresty.org/cn/) ![Build](https://img.shields.io/badge/build-passing-green?style=flat-square) ![Version](https://img.shields.io/github/v/tag/iamtsm/tl-ops-manage?color=green&label=Version&style=flat-square) ![License](https://img.shields.io/badge/License-Apache%202.0-blue?style=flat-square) +[![](https://img.shields.io/badge/base-openresty-blue?style=flat-square)](https://openresty.org/cn/) ![Build](https://img.shields.io/badge/build-passing-green?style=flat-square) ![Version](https://img.shields.io/github/v/tag/iamtsm/tl-ops-manage?color=green&label=Version&style=flat-square) 基于openresty的API网关,支持负载均衡,健康检查,服务熔断,服务限流,waf过滤,黑白名单,动态SSL证书,自定义插件,多级缓存,可视化管理,动态配置,动态插拔插件,数据统计,数据展示,集群部署 diff --git a/balance/tl_ops_balance_core_api.lua b/balance/tl_ops_balance_core_api.lua index 9ded784..72e4093 100644 --- a/balance/tl_ops_balance_core_api.lua +++ b/balance/tl_ops_balance_core_api.lua @@ -184,7 +184,7 @@ local tl_ops_balance_api_service_matcher = function(service_list_table) ngx.var.tlops_ups_api_prefix = fake_sub end end - + return node, node_state, node_id, host, rule_match_mode end diff --git a/bin/install_centeros.sh b/bin/install_centeros.sh index 5c9d75f..2c2f168 100755 --- a/bin/install_centeros.sh +++ b/bin/install_centeros.sh @@ -6,7 +6,7 @@ TL_OPS_PATH="/usr/local/tl-ops-manage/" TL_OPS_CONF_PATH="/usr/local/tl-ops-manage/conf/tl_ops_manage.conf" TL_OPS_LUA_PATH="/usr/local/openresty/lualib/?.lua;;/usr/local/tl-ops-manage/?.lua;;" TL_OPS_LUAC_PATH="/usr/local/openresty/lualib/?.so;;" -TL_OPS_VER="v3.4.4" +TL_OPS_VER="v3.4.5" echo_msg(){ cur_time=$(date "+%Y-%m-%d %H:%M:%S") diff --git a/bin/install_ubuntu.sh b/bin/install_ubuntu.sh index 197a85f..aae71a2 100755 --- a/bin/install_ubuntu.sh +++ b/bin/install_ubuntu.sh @@ -6,7 +6,7 @@ TL_OPS_PATH="/usr/local/tl-ops-manage/" TL_OPS_CONF_PATH="/usr/local/tl-ops-manage/conf/tl_ops_manage.conf" TL_OPS_LUA_PATH="/usr/local/openresty/lualib/?.lua;;/usr/local/tl-ops-manage/?.lua;;" TL_OPS_LUAC_PATH="/usr/local/openresty/lualib/?.so;;" -TL_OPS_VER="v3.4.4" +TL_OPS_VER="v3.4.5" echo_msg(){ cur_time=$(date "+%Y-%m-%d %H:%M:%S") diff --git a/doc/change.md b/doc/change.md index 2594e93..a9794d8 100644 --- a/doc/change.md +++ b/doc/change.md @@ -1,6 +1,13 @@ ## 事务更新日程 +2023-04-22 + + 1. api规则细节限制优化 + + 2. 事务日程调整 + + 2023-03-26 1. 补充部分测试用例 diff --git a/web/balance/tl_ops_web_api.js b/web/balance/tl_ops_web_api.js index dd4c1d6..4b9df0f 100644 --- a/web/balance/tl_ops_web_api.js +++ b/web/balance/tl_ops_web_api.js @@ -372,16 +372,38 @@ const tl_ops_api_data_add_filter = function( data ) { if(rule === 'random'){ delete data.field.node } - for(let key in data.field){ - if(key === 'id' || key === 'rewrite_url' || key === 'fake_prefix'){ - continue; - } - if(data.field[key] === undefined || data.field[key] === null || data.field[key] === ''){ - layer.msg(key + "未填写") - return false; + + let api_type = data.field.api_type; + + if(api_type === 'page'){ + for(let key in data.field){ + if(key === 'id' || key === 'rewrite_url' || key === 'fake_prefix' || key === 'service' || key === 'node'){ + continue; + } + + if(data.field[key] === undefined || data.field[key] === null || data.field[key] === ''){ + layer.msg(key + "未填写") + return false; + } + if(key === 'node'){ + data.field[key] = parseInt(data.field[key]) + } } - if(key === 'node'){ - data.field[key] = parseInt(data.field[key]) + } + + if(api_type === 'api'){ + for(let key in data.field){ + if(key === 'id' || key === 'rewrite_url' || key === 'fake_prefix'){ + continue; + } + + if(data.field[key] === undefined || data.field[key] === null || data.field[key] === ''){ + layer.msg(key + "未填写") + return false; + } + if(key === 'node'){ + data.field[key] = parseInt(data.field[key]) + } } } @@ -402,18 +424,41 @@ const tl_ops_api_data_edit_filter = function( data ) { if(rule === 'random'){ delete data.field.node } - for(let key in data.field){ - if(key === 'rewrite_url' || key === 'fake_prefix'){ - continue - } - if(data.field[key] === undefined || data.field[key] === null || data.field[key] === ''){ - layer.msg(key + "未填写") - return false; + + let api_type = data.field.api_type; + + if(api_type === 'page'){ + for(let key in data.field){ + if(key === 'rewrite_url' || key === 'fake_prefix' || key === 'service' || key === 'node'){ + continue; + } + + if(data.field[key] === undefined || data.field[key] === null || data.field[key] === ''){ + layer.msg(key + "未填写") + return false; + } + if(key === 'node'){ + data.field[key] = parseInt(data.field[key]) + } } - if(key === 'node'){ - data.field[key] = parseInt(data.field[key]) + } + + if(api_type === 'api'){ + for(let key in data.field){ + if(key === 'rewrite_url' || key === 'fake_prefix'){ + continue; + } + + if(data.field[key] === undefined || data.field[key] === null || data.field[key] === ''){ + layer.msg(key + "未填写") + return false; + } + if(key === 'node'){ + data.field[key] = parseInt(data.field[key]) + } } } + let cur_list = [] res_data.tl_ops_balance_api_list[rule].forEach((item)=>{ if(parseInt(item.id) === parseInt(data.field.id)){ diff --git a/web/balance/tl_ops_web_api_form.js b/web/balance/tl_ops_web_api_form.js index 2938432..97f6879 100644 --- a/web/balance/tl_ops_web_api_form.js +++ b/web/balance/tl_ops_web_api_form.js @@ -34,6 +34,16 @@ const tl_ops_web_api_form_main = async function (){ } }); + form.on('radio', function(data){ + if(data.value === 'page'){ + document.getElementById("tl-ops-web-api-form-service-view").style.display = "none"; + document.getElementById("tl-ops-web-api-form-service-node-view").style.display = "none"; + }else if(data.value === 'api'){ + document.getElementById("tl-ops-web-api-form-service-view").style.display = "block"; + document.getElementById("tl-ops-web-api-form-service-node-view").style.display = "block"; + } + }); + let res = await axios.get("/tlops/service/list"); res = res.data; if(res.code === 0){ @@ -61,6 +71,15 @@ const tl_ops_web_api_form_main = async function (){ window.tl_ops_web_api_form_render = function(data){ + if(data){ + if(data.api_type === 'page'){ + document.getElementById("tl-ops-web-api-form-service-view").style.display = "none"; + document.getElementById("tl-ops-web-api-form-service-node-view").style.display = "none"; + }else if(data.api_type === 'api'){ + document.getElementById("tl-ops-web-api-form-service-view").style.display = "block"; + document.getElementById("tl-ops-web-api-form-service-node-view").style.display = "block"; + } + } form.val("tl-ops-web-api-form", Object.assign(form.val("tl-ops-web-api-form"), data)) form.render() document.querySelector("#fake_prefix").dispatchEvent(new Event('input', {}))