From f615cdcb589d9967d34ac651ccbbfb9e3995d4a5 Mon Sep 17 00:00:00 2001 From: "chen.ma" Date: Mon, 28 Feb 2022 21:17:18 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E6=9D=83=E9=99=90=E6=8E=A7=E5=88=B6=E7=B2=92?= =?UTF-8?q?=E5=BA=A6=20#118?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hippo4j-console/src/main/resources/static/index.html | 2 +- .../main/resources/static/static/js/chunk-16eb7b18.68f99a5b.js | 1 - .../main/resources/static/static/js/chunk-16eb7b18.f972e32c.js | 1 + .../main/resources/static/static/js/chunk-648295c6.b27237b1.js | 1 - .../main/resources/static/static/js/chunk-648295c6.b36e1548.js | 1 + .../main/resources/static/static/js/chunk-e25b23da.15e2c94d.js | 1 - .../main/resources/static/static/js/chunk-e25b23da.cd797eb1.js | 1 + 7 files changed, 4 insertions(+), 4 deletions(-) delete mode 100644 hippo4j-console/src/main/resources/static/static/js/chunk-16eb7b18.68f99a5b.js create mode 100644 hippo4j-console/src/main/resources/static/static/js/chunk-16eb7b18.f972e32c.js delete mode 100644 hippo4j-console/src/main/resources/static/static/js/chunk-648295c6.b27237b1.js create mode 100644 hippo4j-console/src/main/resources/static/static/js/chunk-648295c6.b36e1548.js delete mode 100644 hippo4j-console/src/main/resources/static/static/js/chunk-e25b23da.15e2c94d.js create mode 100644 hippo4j-console/src/main/resources/static/static/js/chunk-e25b23da.cd797eb1.js diff --git a/hippo4j-console/src/main/resources/static/index.html b/hippo4j-console/src/main/resources/static/index.html index d36194e5..64af3084 100644 --- a/hippo4j-console/src/main/resources/static/index.html +++ b/hippo4j-console/src/main/resources/static/index.html @@ -1 +1 @@ -Hippo4J Web
\ No newline at end of file +Hippo4J Web
\ No newline at end of file diff --git a/hippo4j-console/src/main/resources/static/static/js/chunk-16eb7b18.68f99a5b.js b/hippo4j-console/src/main/resources/static/static/js/chunk-16eb7b18.68f99a5b.js deleted file mode 100644 index 01628dc6..00000000 --- a/hippo4j-console/src/main/resources/static/static/js/chunk-16eb7b18.68f99a5b.js +++ /dev/null @@ -1 +0,0 @@ -(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-16eb7b18"],{"333d":function(e,t,i){"use strict";var a=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"pagination-container",class:{hidden:e.hidden}},[i("el-pagination",e._b({attrs:{background:e.background,"current-page":e.currentPage,"page-size":e.pageSize,layout:e.layout,"page-sizes":e.pageSizes,total:e.total},on:{"update:currentPage":function(t){e.currentPage=t},"update:current-page":function(t){e.currentPage=t},"update:pageSize":function(t){e.pageSize=t},"update:page-size":function(t){e.pageSize=t},"size-change":e.handleSizeChange,"current-change":e.handleCurrentChange}},"el-pagination",e.$attrs,!1))],1)},n=[];i("c5f6");Math.easeInOutQuad=function(e,t,i,a){return e/=a/2,e<1?i/2*e*e+t:(e--,-i/2*(e*(e-2)-1)+t)};var l=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(e){window.setTimeout(e,1e3/60)}}();function r(e){document.documentElement.scrollTop=e,document.body.parentNode.scrollTop=e,document.body.scrollTop=e}function s(){return document.documentElement.scrollTop||document.body.parentNode.scrollTop||document.body.scrollTop}function o(e,t,i){var a=s(),n=e-a,o=20,c=0;t="undefined"===typeof t?500:t;var u=function e(){c+=o;var s=Math.easeInOutQuad(c,a,n,t);r(s),c0,expression:"total > 0"}],attrs:{total:e.total,page:e.listQuery.current,limit:e.listQuery.size},on:{"update:page":function(t){return e.$set(e.listQuery,"current",t)},"update:limit":function(t){return e.$set(e.listQuery,"size",t)},pagination:e.fetchData}}),e._v(" "),i("el-dialog",{attrs:{title:e.textMap[e.dialogStatus],visible:e.dialogFormVisible,width:"1000px"},on:{"update:visible":function(t){e.dialogFormVisible=t}}},[i("el-form",{ref:"dataForm",attrs:{rules:e.rules,model:e.temp,"label-position":"left","label-width":"110px"}},[i("el-row",{attrs:{gutter:20}},[i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:"《基本信息》"}})],1)],1),e._v(" "),i("el-row",{attrs:{gutter:20}},[i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:"租户ID",prop:"tenantId"}},[i("el-select",{staticStyle:{display:"block"},attrs:{placeholder:"请选择租户",disabled:"create"!==e.dialogStatus},on:{change:function(t){return e.tenantTempSelectList()}},model:{value:e.temp.tenantId,callback:function(t){e.$set(e.temp,"tenantId",t)},expression:"temp.tenantId"}},e._l(e.tenantOptions,(function(e){return i("el-option",{key:e.key,attrs:{label:e.display_name,value:e.key}})})),1)],1)],1),e._v(" "),i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:"核心线程",prop:"coreSize"}},[i("el-input-number",{attrs:{placeholder:"核心线程",min:1,max:999},model:{value:e.temp.coreSize,callback:function(t){e.$set(e.temp,"coreSize",t)},expression:"temp.coreSize"}})],1)],1)],1),e._v(" "),i("el-row",{attrs:{gutter:20}},[i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:"项目ID",prop:"itemId"}},[i("el-select",{staticStyle:{display:"block"},attrs:{placeholder:"请选择项目",disabled:"create"!==e.dialogStatus},model:{value:e.temp.itemId,callback:function(t){e.$set(e.temp,"itemId",t)},expression:"temp.itemId"}},e._l(e.itemTempOptions,(function(e){return i("el-option",{key:e.key,attrs:{label:e.display_name,value:e.key}})})),1)],1)],1),e._v(" "),i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:"最大线程",prop:"maxSize"}},[i("el-input-number",{attrs:{placeholder:"最大线程",min:1,max:999},model:{value:e.temp.maxSize,callback:function(t){e.$set(e.temp,"maxSize",t)},expression:"temp.maxSize"}})],1)],1)],1),e._v(" "),i("el-row",{attrs:{gutter:20}},[i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:"线程池ID",prop:"tpId"}},[i("el-input",{attrs:{size:"medium",placeholder:"请输入线程池ID",disabled:"create"!==e.dialogStatus},model:{value:e.temp.tpId,callback:function(t){e.$set(e.temp,"tpId",t)},expression:"temp.tpId"}})],1)],1)],1),e._v(" "),i("el-row",{attrs:{gutter:20}},[i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:"《扩展信息》"}})],1)],1),e._v(" "),i("el-row",{attrs:{gutter:20}},[i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:"队列类型",prop:"queueType"}},[i("el-select",{staticStyle:{display:"block"},attrs:{placeholder:"队列类型"},on:{change:e.selectQueueType},model:{value:e.temp.queueType,callback:function(t){e.$set(e.temp,"queueType",t)},expression:"temp.queueType"}},e._l(e.queueTypeOptions,(function(e){return i("el-option",{key:e.key,attrs:{label:e.display_name,value:e.key}})})),1)],1)],1),e._v(" "),i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:"队列容量",prop:"capacity"}},[i("el-input-number",{attrs:{placeholder:"队列容量",min:0,max:2147483647,disabled:4===e.temp.queueType||5===e.temp.queueType},model:{value:e.temp.capacity,callback:function(t){e.$set(e.temp,"capacity",t)},expression:"temp.capacity"}})],1)],1)],1),e._v(" "),i("el-row",{attrs:{gutter:20}},[i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:"核心线程超时",prop:"isAlarm"}},[i("el-select",{staticStyle:{display:"block"},attrs:{placeholder:"核心线程超时"},model:{value:e.temp.allowCoreThreadTimeOut,callback:function(t){e.$set(e.temp,"allowCoreThreadTimeOut",t)},expression:"temp.allowCoreThreadTimeOut"}},e._l(e.allowCoreThreadTimeOutTypes,(function(e){return i("el-option",{key:e.key,attrs:{label:e.display_name,value:e.key}})})),1)],1)],1),e._v(" "),i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:"KATime/S",prop:"keepAliveTime"}},[i("el-input-number",{attrs:{placeholder:"Time / S",min:1,max:99999},model:{value:e.temp.keepAliveTime,callback:function(t){e.$set(e.temp,"keepAliveTime",t)},expression:"temp.keepAliveTime"}})],1)],1)],1),e._v(" "),i("el-row",{attrs:{gutter:20}},[i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:"是否报警",prop:"isAlarm"}},[i("el-select",{staticStyle:{display:"block"},attrs:{placeholder:"是否报警"},model:{value:e.temp.isAlarm,callback:function(t){e.$set(e.temp,"isAlarm",t)},expression:"temp.isAlarm"}},e._l(e.alarmTypes,(function(e){return i("el-option",{key:e.key,attrs:{label:e.display_name,value:e.key}})})),1)],1)],1),e._v(" "),i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:"活跃度报警",prop:"livenessAlarm"}},[i("el-input-number",{attrs:{placeholder:"活跃度报警",min:30,max:90},model:{value:e.temp.livenessAlarm,callback:function(t){e.$set(e.temp,"livenessAlarm",t)},expression:"temp.livenessAlarm"}})],1)],1)],1),e._v(" "),i("el-row",{attrs:{gutter:20}},[i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:"拒绝策略",prop:"rejectedType"}},[i("el-select",{staticStyle:{display:"block"},attrs:{placeholder:"拒绝策略"},on:{change:e.selectRejectedType},model:{value:e.temp.rejectedType,callback:function(t){e.$set(e.temp,"rejectedType",t)},expression:"temp.rejectedType"}},e._l(e.rejectedOptions,(function(e){return i("el-option",{key:e.key,attrs:{label:e.display_name,value:e.key}})})),1)],1)],1),e._v(" "),i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:"容量报警",prop:"capacityAlarm"}},[i("el-input-number",{attrs:{placeholder:"容量报警",min:30,max:90},model:{value:e.temp.capacityAlarm,callback:function(t){e.$set(e.temp,"capacityAlarm",t)},expression:"temp.capacityAlarm"}})],1)],1)],1),e._v(" "),e.isRejectShow?i("el-row",{attrs:{gutter:20}},[i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:"SPI 拒绝策略",prop:"customRejectedType"}},[i("el-input",{attrs:{placeholder:"请输入自定义 SPI 拒绝策略标识"},on:{input:function(t){return e.onInput()}},model:{value:e.temp.customRejectedType,callback:function(t){e.$set(e.temp,"customRejectedType",t)},expression:"temp.customRejectedType"}})],1)],1)],1):e._e()],1),e._v(" "),i("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[i("el-button",{on:{click:function(t){e.dialogFormVisible=!1}}},[e._v("\n 取消\n ")]),e._v(" "),i("el-button",{attrs:{type:"primary"},on:{click:function(t){"create"===e.dialogStatus?e.createData():e.updateData()}}},[e._v("\n 确认\n ")])],1)],1),e._v(" "),i("el-dialog",{attrs:{visible:e.dialogPluginVisible,title:"Reading statistics"},on:{"update:visible":function(t){e.dialogPluginVisible=t}}},[i("el-table",{staticStyle:{width:"100%"},attrs:{data:e.pluginData,border:"",fit:"","highlight-current-row":""}},[i("el-table-column",{attrs:{prop:"key",label:"Channel"}}),e._v(" "),i("el-table-column",{attrs:{prop:"pv",label:"Pv"}})],1),e._v(" "),i("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[i("el-button",{attrs:{type:"primary"},on:{click:function(t){e.dialogPvVisible=!1}}},[e._v("Confirm")])],1)],1)],1)},n=[],l=(i("ac6a"),i("456d"),i("3737")),r=i("dd71"),s=i("4d85"),o=i("6724"),c=i("333d"),u={name:"JobProject",components:{Pagination:c["a"]},directives:{waves:o["a"]},filters:{statusFilter:function(e){var t={published:"success",draft:"gray",deleted:"danger"};return t[e]},queueFilter:function(e){return"1"==e?"ArrayBlockingQueue":"2"==e?"LinkedBlockingQueue":"3"==e?"LinkedBlockingDeque":"4"==e?"SynchronousQueue":"5"==e?"LinkedTransferQueue":"6"==e?"PriorityBlockingQueue":"9"==e?"ResizableLinkedBlockingQueue":void 0}},data:function(){var e=this;return{isRejectShow:!1,list:null,listLoading:!0,total:0,listQuery:{current:1,size:10,tpId:"",itemId:""},pluginTypeOptions:["reader","writer"],dialogPluginVisible:!1,pluginData:[],dialogFormVisible:!1,tenantOptions:[],threadPoolOptions:[],itemOptions:[],itemTempOptions:[],queueTypeOptions:[{key:1,display_name:"ArrayBlockingQueue"},{key:2,display_name:"LinkedBlockingQueue"},{key:3,display_name:"LinkedBlockingDeque"},{key:4,display_name:"SynchronousQueue"},{key:5,display_name:"LinkedTransferQueue"},{key:6,display_name:"PriorityBlockingQueue"},{key:9,display_name:"ResizableLinkedBlockingQueue (支持动态修改队列大小)"}],rejectedOptions:[{key:1,display_name:"CallerRunsPolicy"},{key:2,display_name:"AbortPolicy"},{key:3,display_name:"DiscardPolicy"},{key:4,display_name:"DiscardOldestPolicy"},{key:5,display_name:"RunsOldestTaskPolicy"},{key:6,display_name:"SyncPutQueuePolicy"},{key:99,display_name:"CustomRejectedPolicy(自定义 SPI 策略)"}],alarmTypes:[{key:1,display_name:"报警"},{key:0,display_name:"不报警"}],allowCoreThreadTimeOutTypes:[{key:1,display_name:"超时"},{key:0,display_name:"不超时"}],size:500,dialogStatus:"",textMap:{update:"Edit",create:"Create"},rules:{tenantId:[{required:!0,message:"this is required",trigger:"blur"}],itemId:[{required:!0,message:"this is required",trigger:"blur"}],tpId:[{required:!0,message:"this is required",trigger:"blur"}],coreSize:[{required:!0,message:"this is required",trigger:"blur"}],maxSize:[{required:!0,message:"this is required",trigger:"blur"},{validator:function(t,i,a){parseInt(i)0,expression:"total > 0"}],attrs:{total:e.total,page:e.listQuery.current,limit:e.listQuery.size},on:{"update:page":function(t){return e.$set(e.listQuery,"current",t)},"update:limit":function(t){return e.$set(e.listQuery,"size",t)},pagination:e.fetchData}}),e._v(" "),i("el-dialog",{attrs:{title:e.textMap[e.dialogStatus],visible:e.dialogFormVisible,width:"1000px"},on:{"update:visible":function(t){e.dialogFormVisible=t}}},[i("el-form",{ref:"dataForm",attrs:{rules:e.rules,model:e.temp,"label-position":"left","label-width":"110px"}},[i("el-row",{attrs:{gutter:20}},[i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:"《基本信息》"}})],1)],1),e._v(" "),i("el-row",{attrs:{gutter:20}},[i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:"租户ID",prop:"tenantId"}},[i("el-select",{staticStyle:{display:"block"},attrs:{placeholder:"请选择租户",disabled:"create"!==e.dialogStatus},on:{change:function(t){return e.tenantTempSelectList()}},model:{value:e.temp.tenantId,callback:function(t){e.$set(e.temp,"tenantId",t)},expression:"temp.tenantId"}},e._l(e.tenantOptions,(function(e){return i("el-option",{key:e.key,attrs:{label:e.display_name,value:e.key}})})),1)],1)],1),e._v(" "),i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:"核心线程",prop:"coreSize"}},[i("el-input-number",{attrs:{placeholder:"核心线程",min:1,max:999},model:{value:e.temp.coreSize,callback:function(t){e.$set(e.temp,"coreSize",t)},expression:"temp.coreSize"}})],1)],1)],1),e._v(" "),i("el-row",{attrs:{gutter:20}},[i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:"项目ID",prop:"itemId"}},[i("el-select",{staticStyle:{display:"block"},attrs:{placeholder:"请选择项目",disabled:"create"!==e.dialogStatus},model:{value:e.temp.itemId,callback:function(t){e.$set(e.temp,"itemId",t)},expression:"temp.itemId"}},e._l(e.itemTempOptions,(function(e){return i("el-option",{key:e.key,attrs:{label:e.display_name,value:e.key}})})),1)],1)],1),e._v(" "),i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:"最大线程",prop:"maxSize"}},[i("el-input-number",{attrs:{placeholder:"最大线程",min:1,max:999},model:{value:e.temp.maxSize,callback:function(t){e.$set(e.temp,"maxSize",t)},expression:"temp.maxSize"}})],1)],1)],1),e._v(" "),i("el-row",{attrs:{gutter:20}},[i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:"线程池ID",prop:"tpId"}},[i("el-input",{attrs:{size:"medium",placeholder:"请输入线程池ID",disabled:"create"!==e.dialogStatus},model:{value:e.temp.tpId,callback:function(t){e.$set(e.temp,"tpId",t)},expression:"temp.tpId"}})],1)],1)],1),e._v(" "),i("el-row",{attrs:{gutter:20}},[i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:"《扩展信息》"}})],1)],1),e._v(" "),i("el-row",{attrs:{gutter:20}},[i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:"队列类型",prop:"queueType"}},[i("el-select",{staticStyle:{display:"block"},attrs:{placeholder:"队列类型"},on:{change:e.selectQueueType},model:{value:e.temp.queueType,callback:function(t){e.$set(e.temp,"queueType",t)},expression:"temp.queueType"}},e._l(e.queueTypeOptions,(function(e){return i("el-option",{key:e.key,attrs:{label:e.display_name,value:e.key}})})),1)],1)],1),e._v(" "),i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:"队列容量",prop:"capacity"}},[i("el-input-number",{attrs:{placeholder:"队列容量",min:0,max:2147483647,disabled:4===e.temp.queueType||5===e.temp.queueType},model:{value:e.temp.capacity,callback:function(t){e.$set(e.temp,"capacity",t)},expression:"temp.capacity"}})],1)],1)],1),e._v(" "),i("el-row",{attrs:{gutter:20}},[i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:"核心线程超时",prop:"isAlarm"}},[i("el-select",{staticStyle:{display:"block"},attrs:{placeholder:"核心线程超时"},model:{value:e.temp.allowCoreThreadTimeOut,callback:function(t){e.$set(e.temp,"allowCoreThreadTimeOut",t)},expression:"temp.allowCoreThreadTimeOut"}},e._l(e.allowCoreThreadTimeOutTypes,(function(e){return i("el-option",{key:e.key,attrs:{label:e.display_name,value:e.key}})})),1)],1)],1),e._v(" "),i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:"KATime/S",prop:"keepAliveTime"}},[i("el-input-number",{attrs:{placeholder:"Time / S",min:1,max:99999},model:{value:e.temp.keepAliveTime,callback:function(t){e.$set(e.temp,"keepAliveTime",t)},expression:"temp.keepAliveTime"}})],1)],1)],1),e._v(" "),i("el-row",{attrs:{gutter:20}},[i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:"是否报警",prop:"isAlarm"}},[i("el-select",{staticStyle:{display:"block"},attrs:{placeholder:"是否报警"},model:{value:e.temp.isAlarm,callback:function(t){e.$set(e.temp,"isAlarm",t)},expression:"temp.isAlarm"}},e._l(e.alarmTypes,(function(e){return i("el-option",{key:e.key,attrs:{label:e.display_name,value:e.key}})})),1)],1)],1),e._v(" "),i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:"活跃度报警",prop:"livenessAlarm"}},[i("el-input-number",{attrs:{placeholder:"活跃度报警",min:30,max:90},model:{value:e.temp.livenessAlarm,callback:function(t){e.$set(e.temp,"livenessAlarm",t)},expression:"temp.livenessAlarm"}})],1)],1)],1),e._v(" "),i("el-row",{attrs:{gutter:20}},[i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:"拒绝策略",prop:"rejectedType"}},[i("el-select",{staticStyle:{display:"block"},attrs:{placeholder:"拒绝策略"},on:{change:e.selectRejectedType},model:{value:e.temp.rejectedType,callback:function(t){e.$set(e.temp,"rejectedType",t)},expression:"temp.rejectedType"}},e._l(e.rejectedOptions,(function(e){return i("el-option",{key:e.key,attrs:{label:e.display_name,value:e.key}})})),1)],1)],1),e._v(" "),i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:"容量报警",prop:"capacityAlarm"}},[i("el-input-number",{attrs:{placeholder:"容量报警",min:30,max:90},model:{value:e.temp.capacityAlarm,callback:function(t){e.$set(e.temp,"capacityAlarm",t)},expression:"temp.capacityAlarm"}})],1)],1)],1),e._v(" "),e.isRejectShow?i("el-row",{attrs:{gutter:20}},[i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:"SPI 拒绝策略",prop:"customRejectedType"}},[i("el-input",{attrs:{placeholder:"请输入自定义 SPI 拒绝策略标识"},on:{input:function(t){return e.onInput()}},model:{value:e.temp.customRejectedType,callback:function(t){e.$set(e.temp,"customRejectedType",t)},expression:"temp.customRejectedType"}})],1)],1)],1):e._e()],1),e._v(" "),i("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[i("el-button",{on:{click:function(t){e.dialogFormVisible=!1}}},[e._v("\n 取消\n ")]),e._v(" "),i("el-button",{attrs:{type:"primary"},on:{click:function(t){"create"===e.dialogStatus?e.createData():e.updateData()}}},[e._v("\n 确认\n ")])],1)],1),e._v(" "),i("el-dialog",{attrs:{visible:e.dialogPluginVisible,title:"Reading statistics"},on:{"update:visible":function(t){e.dialogPluginVisible=t}}},[i("el-table",{staticStyle:{width:"100%"},attrs:{data:e.pluginData,border:"",fit:"","highlight-current-row":""}},[i("el-table-column",{attrs:{prop:"key",label:"Channel"}}),e._v(" "),i("el-table-column",{attrs:{prop:"pv",label:"Pv"}})],1),e._v(" "),i("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[i("el-button",{attrs:{type:"primary"},on:{click:function(t){e.dialogPvVisible=!1}}},[e._v("Confirm")])],1)],1)],1)},n=[],l=(i("ac6a"),i("456d"),i("3737")),r=i("dd71"),s=i("4d85"),o=i("6724"),c=i("333d"),u={name:"JobProject",components:{Pagination:c["a"]},directives:{waves:o["a"]},filters:{statusFilter:function(e){var t={published:"success",draft:"gray",deleted:"danger"};return t[e]},queueFilter:function(e){return"1"==e?"ArrayBlockingQueue":"2"==e?"LinkedBlockingQueue":"3"==e?"LinkedBlockingDeque":"4"==e?"SynchronousQueue":"5"==e?"LinkedTransferQueue":"6"==e?"PriorityBlockingQueue":"9"==e?"ResizableLinkedBlockingQueue":void 0}},data:function(){var e=this;return{isRejectShow:!1,list:null,listLoading:!0,total:0,listQuery:{current:1,size:10,tpId:"",itemId:""},pluginTypeOptions:["reader","writer"],dialogPluginVisible:!1,pluginData:[],isEditDisabled:!1,dialogFormVisible:!1,tenantOptions:[],threadPoolOptions:[],itemOptions:[],itemTempOptions:[],queueTypeOptions:[{key:1,display_name:"ArrayBlockingQueue"},{key:2,display_name:"LinkedBlockingQueue"},{key:3,display_name:"LinkedBlockingDeque"},{key:4,display_name:"SynchronousQueue"},{key:5,display_name:"LinkedTransferQueue"},{key:6,display_name:"PriorityBlockingQueue"},{key:9,display_name:"ResizableLinkedBlockingQueue (支持动态修改队列大小)"}],rejectedOptions:[{key:1,display_name:"CallerRunsPolicy"},{key:2,display_name:"AbortPolicy"},{key:3,display_name:"DiscardPolicy"},{key:4,display_name:"DiscardOldestPolicy"},{key:5,display_name:"RunsOldestTaskPolicy"},{key:6,display_name:"SyncPutQueuePolicy"},{key:99,display_name:"CustomRejectedPolicy(自定义 SPI 策略)"}],alarmTypes:[{key:1,display_name:"报警"},{key:0,display_name:"不报警"}],allowCoreThreadTimeOutTypes:[{key:1,display_name:"超时"},{key:0,display_name:"不超时"}],size:500,dialogStatus:"",textMap:{update:"Edit",create:"Create"},rules:{tenantId:[{required:!0,message:"this is required",trigger:"blur"}],itemId:[{required:!0,message:"this is required",trigger:"blur"}],tpId:[{required:!0,message:"this is required",trigger:"blur"}],coreSize:[{required:!0,message:"this is required",trigger:"blur"}],maxSize:[{required:!0,message:"this is required",trigger:"blur"},{validator:function(t,i,a){parseInt(i)0,expression:"total > 0"}],attrs:{total:e.total,page:e.listQuery.current,limit:e.listQuery.size},on:{"update:page":function(t){return e.$set(e.listQuery,"current",t)},"update:limit":function(t){return e.$set(e.listQuery,"size",t)},pagination:e.fetchData}}),e._v(" "),n("el-dialog",{attrs:{title:e.textMap[e.dialogStatus],visible:e.dialogFormVisible,width:"800px"},on:{"update:visible":function(t){e.dialogFormVisible=t}}},[n("el-form",{ref:"dataForm",attrs:{rules:e.rules,model:e.temp,"label-position":"left","label-width":"100px"}},[n("el-form-item",{attrs:{label:"租户ID",prop:"tenantId"}},[n("el-input",{staticStyle:{width:"40%"},attrs:{disabled:"create"!==e.dialogStatus,placeholder:"租户ID"},model:{value:e.temp.tenantId,callback:function(t){e.$set(e.temp,"tenantId",t)},expression:"temp.tenantId"}})],1),e._v(" "),n("el-form-item",{attrs:{label:"租户名称",prop:"tenantName"}},[n("el-input",{staticStyle:{width:"40%"},attrs:{placeholder:"租户名称"},model:{value:e.temp.tenantName,callback:function(t){e.$set(e.temp,"tenantName",t)},expression:"temp.tenantName"}})],1),e._v(" "),n("el-form-item",{attrs:{label:"OWNER",prop:"owner"}},[n("el-input",{staticStyle:{width:"40%"},attrs:{placeholder:"OWNER"},model:{value:e.temp.owner,callback:function(t){e.$set(e.temp,"owner",t)},expression:"temp.owner"}})],1),e._v(" "),n("el-form-item",{attrs:{label:"租户描述",prop:"tenantDesc"}},[n("el-input",{staticStyle:{width:"40%"},attrs:{autosize:{minRows:3,maxRows:6},type:"textarea",placeholder:"租户描述"},model:{value:e.temp.tenantDesc,callback:function(t){e.$set(e.temp,"tenantDesc",t)},expression:"temp.tenantDesc"}})],1)],1),e._v(" "),n("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[n("el-button",{on:{click:function(t){e.dialogFormVisible=!1}}},[e._v("\n 取消\n ")]),e._v(" "),n("el-button",{attrs:{type:"primary"},on:{click:function(t){"create"===e.dialogStatus?e.createData():e.updateData()}}},[e._v("\n 确认\n ")])],1)],1),e._v(" "),n("el-dialog",{attrs:{visible:e.dialogPluginVisible,title:"Reading statistics"},on:{"update:visible":function(t){e.dialogPluginVisible=t}}},[n("el-table",{staticStyle:{width:"100%"},attrs:{data:e.pluginData,border:"",fit:"","highlight-current-row":""}},[n("el-table-column",{attrs:{prop:"key",label:"Channel"}}),e._v(" "),n("el-table-column",{attrs:{prop:"pv",label:"Pv"}})],1),e._v(" "),n("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[n("el-button",{attrs:{type:"primary"},on:{click:function(t){e.dialogPvVisible=!1}}},[e._v("Confirm")])],1)],1)],1)},i=[],l=n("dd71"),o=n("6724"),r=n("333d"),s={name:"JobProject",components:{Pagination:r["a"]},directives:{waves:o["a"]},filters:{statusFilter:function(e){var t={published:"success",draft:"gray",deleted:"danger"};return t[e]},ellipsis:function(e){return e?e.length>26?e.slice(0,26)+"...":e:""}},data:function(){return{list:null,listLoading:!0,total:0,listQuery:{current:1,size:10,tenantId:""},pluginTypeOptions:["reader","writer"],dialogPluginVisible:!1,pluginData:[],dialogFormVisible:!1,dialogStatus:"",textMap:{update:"Edit",create:"Create"},rules:{tenantId:[{required:!0,message:"this is required",trigger:"blur"}],tenantName:[{required:!0,message:"this is required",trigger:"blur"}],owner:[{required:!0,message:"this is required",trigger:"blur"}],tenantDesc:[{required:!0,message:"this is required",trigger:"blur"}]},temp:{id:void 0,tenantId:"",tenantName:"",owner:"",tenantDesc:""},visible:!0}},created:function(){this.fetchData()},methods:{fetchData:function(){var e=this;this.listLoading=!0,l["c"](this.listQuery).then((function(t){var n=t.records,a=t.total;e.total=a,e.list=n,e.listLoading=!1}))},resetTemp:function(){this.temp={id:void 0,tenantName:"",tenantDesc:""}},handleCreate:function(){var e=this;this.resetTemp(),this.dialogStatus="create",this.dialogFormVisible=!0,this.$nextTick((function(){e.$refs["dataForm"].clearValidate()}))},createData:function(){var e=this;this.$refs["dataForm"].validate((function(t){t&&l["a"](e.temp).then((function(){e.fetchData(),e.dialogFormVisible=!1,e.$notify({title:"Success",message:"Created Successfully",type:"success",duration:2e3})}))}))},handleUpdate:function(e){var t=this;this.temp=Object.assign({},e),this.dialogStatus="update",this.dialogFormVisible=!0,this.$nextTick((function(){t.$refs["dataForm"].clearValidate()}))},updateData:function(){var e=this;this.$refs["dataForm"].validate((function(t){if(t){var n=Object.assign({},e.temp);l["d"](n).then((function(){e.fetchData(),e.dialogFormVisible=!1,e.$notify({title:"Success",message:"Update Successfully",type:"success",duration:2e3})}))}}))},openDelConfirm:function(e){return this.$confirm("此操作将删除 ".concat(e,", 是否继续?"),"提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"})},handleDelete:function(e){var t=this;this.openDelConfirm(e.tenantId).then((function(){l["b"](e.tenantId).then((function(e){t.fetchData(),t.$notify({title:"Success",message:"Delete Successfully",type:"success",duration:2e3})}))}))}}},u=s,c=n("2877"),d=Object(c["a"])(u,a,i,!1,null,null,null);t["default"]=d.exports},6724:function(e,t,n){"use strict";n("8d41");var a="@@wavesContext";function i(e,t){function n(n){var a=Object.assign({},t.value),i=Object.assign({ele:e,type:"hit",color:"rgba(0, 0, 0, 0.15)"},a),l=i.ele;if(l){l.style.position="relative",l.style.overflow="hidden";var o=l.getBoundingClientRect(),r=l.querySelector(".waves-ripple");switch(r?r.className="waves-ripple":(r=document.createElement("span"),r.className="waves-ripple",r.style.height=r.style.width=Math.max(o.width,o.height)+"px",l.appendChild(r)),i.type){case"center":r.style.top=o.height/2-r.offsetHeight/2+"px",r.style.left=o.width/2-r.offsetWidth/2+"px";break;default:r.style.top=(n.pageY-o.top-r.offsetHeight/2-document.documentElement.scrollTop||document.body.scrollTop)+"px",r.style.left=(n.pageX-o.left-r.offsetWidth/2-document.documentElement.scrollLeft||document.body.scrollLeft)+"px"}return r.style.backgroundColor=i.color,r.className="waves-ripple z-active",!1}}return e[a]?e[a].removeHandle=n:e[a]={removeHandle:n},n}var l={bind:function(e,t){e.addEventListener("click",i(e,t),!1)},update:function(e,t){e.removeEventListener("click",e[a].removeHandle,!1),e.addEventListener("click",i(e,t),!1)},unbind:function(e){e.removeEventListener("click",e[a].removeHandle,!1),e[a]=null,delete e[a]}},o=function(e){e.directive("waves",l)};window.Vue&&(window.waves=l,Vue.use(o)),l.install=o;t["a"]=l},7456:function(e,t,n){},"8d41":function(e,t,n){},dd71:function(e,t,n){"use strict";n.d(t,"c",(function(){return i})),n.d(t,"d",(function(){return l})),n.d(t,"a",(function(){return o})),n.d(t,"b",(function(){return r}));var a=n("b775");function i(e){return Object(a["a"])({url:"/hippo4j/v1/cs/tenant/query/page",method:"post",data:e})}function l(e){return Object(a["a"])({url:"/hippo4j/v1/cs/tenant/update",method:"post",data:e})}function o(e){return Object(a["a"])({url:"/hippo4j/v1/cs/tenant/save",method:"post",data:e})}function r(e){return Object(a["a"])({url:"/hippo4j/v1/cs/tenant/delete/"+e,method:"delete"})}},e498:function(e,t,n){"use strict";n("7456")}}]); \ No newline at end of file diff --git a/hippo4j-console/src/main/resources/static/static/js/chunk-648295c6.b36e1548.js b/hippo4j-console/src/main/resources/static/static/js/chunk-648295c6.b36e1548.js new file mode 100644 index 00000000..cdedf73b --- /dev/null +++ b/hippo4j-console/src/main/resources/static/static/js/chunk-648295c6.b36e1548.js @@ -0,0 +1 @@ +(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-648295c6"],{"333d":function(t,e,n){"use strict";var a=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"pagination-container",class:{hidden:t.hidden}},[n("el-pagination",t._b({attrs:{background:t.background,"current-page":t.currentPage,"page-size":t.pageSize,layout:t.layout,"page-sizes":t.pageSizes,total:t.total},on:{"update:currentPage":function(e){t.currentPage=e},"update:current-page":function(e){t.currentPage=e},"update:pageSize":function(e){t.pageSize=e},"update:page-size":function(e){t.pageSize=e},"size-change":t.handleSizeChange,"current-change":t.handleCurrentChange}},"el-pagination",t.$attrs,!1))],1)},i=[];n("c5f6");Math.easeInOutQuad=function(t,e,n,a){return t/=a/2,t<1?n/2*t*t+e:(t--,-n/2*(t*(t-2)-1)+e)};var l=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(t){window.setTimeout(t,1e3/60)}}();function o(t){document.documentElement.scrollTop=t,document.body.parentNode.scrollTop=t,document.body.scrollTop=t}function r(){return document.documentElement.scrollTop||document.body.parentNode.scrollTop||document.body.scrollTop}function s(t,e,n){var a=r(),i=t-a,s=20,u=0;e="undefined"===typeof e?500:e;var c=function t(){u+=s;var r=Math.easeInOutQuad(u,a,i,e);o(r),u0,expression:"total > 0"}],attrs:{total:t.total,page:t.listQuery.current,limit:t.listQuery.size},on:{"update:page":function(e){return t.$set(t.listQuery,"current",e)},"update:limit":function(e){return t.$set(t.listQuery,"size",e)},pagination:t.fetchData}}),t._v(" "),n("el-dialog",{attrs:{title:t.textMap[t.dialogStatus],visible:t.dialogFormVisible,width:"800px"},on:{"update:visible":function(e){t.dialogFormVisible=e}}},[n("el-form",{ref:"dataForm",attrs:{rules:t.rules,model:t.temp,"label-position":"left","label-width":"100px"}},[n("el-form-item",{attrs:{label:"租户ID",prop:"tenantId"}},[n("el-input",{staticStyle:{width:"40%"},attrs:{disabled:"create"!==t.dialogStatus,placeholder:"租户ID"},model:{value:t.temp.tenantId,callback:function(e){t.$set(t.temp,"tenantId",e)},expression:"temp.tenantId"}})],1),t._v(" "),n("el-form-item",{attrs:{label:"租户名称",prop:"tenantName"}},[n("el-input",{staticStyle:{width:"40%"},attrs:{placeholder:"租户名称"},model:{value:t.temp.tenantName,callback:function(e){t.$set(t.temp,"tenantName",e)},expression:"temp.tenantName"}})],1),t._v(" "),n("el-form-item",{attrs:{label:"OWNER",prop:"owner"}},[n("el-input",{staticStyle:{width:"40%"},attrs:{placeholder:"OWNER"},model:{value:t.temp.owner,callback:function(e){t.$set(t.temp,"owner",e)},expression:"temp.owner"}})],1),t._v(" "),n("el-form-item",{attrs:{label:"租户描述",prop:"tenantDesc"}},[n("el-input",{staticStyle:{width:"40%"},attrs:{autosize:{minRows:3,maxRows:6},type:"textarea",placeholder:"租户描述"},model:{value:t.temp.tenantDesc,callback:function(e){t.$set(t.temp,"tenantDesc",e)},expression:"temp.tenantDesc"}})],1)],1),t._v(" "),n("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[n("el-button",{on:{click:function(e){t.dialogFormVisible=!1}}},[t._v("\n 取消\n ")]),t._v(" "),n("el-button",{attrs:{type:"primary"},on:{click:function(e){"create"===t.dialogStatus?t.createData():t.updateData()}}},[t._v("\n 确认\n ")])],1)],1),t._v(" "),n("el-dialog",{attrs:{visible:t.dialogPluginVisible,title:"Reading statistics"},on:{"update:visible":function(e){t.dialogPluginVisible=e}}},[n("el-table",{staticStyle:{width:"100%"},attrs:{data:t.pluginData,border:"",fit:"","highlight-current-row":""}},[n("el-table-column",{attrs:{prop:"key",label:"Channel"}}),t._v(" "),n("el-table-column",{attrs:{prop:"pv",label:"Pv"}})],1),t._v(" "),n("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[n("el-button",{attrs:{type:"primary"},on:{click:function(e){t.dialogPvVisible=!1}}},[t._v("Confirm")])],1)],1)],1)},i=[],l=n("dd71"),o=n("6724"),r=n("333d"),s={name:"JobProject",components:{Pagination:r["a"]},directives:{waves:o["a"]},filters:{statusFilter:function(t){var e={published:"success",draft:"gray",deleted:"danger"};return e[t]},ellipsis:function(t){return t?t.length>26?t.slice(0,26)+"...":t:""}},data:function(){return{list:null,listLoading:!0,total:0,listQuery:{current:1,size:10,tenantId:""},pluginTypeOptions:["reader","writer"],dialogPluginVisible:!1,pluginData:[],isEditDisabled:!1,dialogFormVisible:!1,dialogStatus:"",textMap:{update:"Edit",create:"Create"},rules:{tenantId:[{required:!0,message:"this is required",trigger:"blur"}],tenantName:[{required:!0,message:"this is required",trigger:"blur"}],owner:[{required:!0,message:"this is required",trigger:"blur"}],tenantDesc:[{required:!0,message:"this is required",trigger:"blur"}]},temp:{id:void 0,tenantId:"",tenantName:"",owner:"",tenantDesc:""},visible:!0}},created:function(){this.fetchData()},mounted:function(){this.isEditDisabled="admin"!==this.$cookie.get("userName")},methods:{fetchData:function(){var t=this;this.listLoading=!0,l["c"](this.listQuery).then((function(e){var n=e.records,a=e.total;t.total=a,t.list=n,t.listLoading=!1}))},resetTemp:function(){this.temp={id:void 0,tenantName:"",tenantDesc:""}},handleCreate:function(){var t=this;this.resetTemp(),this.dialogStatus="create",this.dialogFormVisible=!0,this.$nextTick((function(){t.$refs["dataForm"].clearValidate()}))},createData:function(){var t=this;this.$refs["dataForm"].validate((function(e){e&&l["a"](t.temp).then((function(){t.fetchData(),t.dialogFormVisible=!1,t.$notify({title:"Success",message:"Created Successfully",type:"success",duration:2e3})}))}))},handleUpdate:function(t){var e=this;this.temp=Object.assign({},t),this.dialogStatus="update",this.dialogFormVisible=!0,this.$nextTick((function(){e.$refs["dataForm"].clearValidate()}))},updateData:function(){var t=this;this.$refs["dataForm"].validate((function(e){if(e){var n=Object.assign({},t.temp);l["d"](n).then((function(){t.fetchData(),t.dialogFormVisible=!1,t.$notify({title:"Success",message:"Update Successfully",type:"success",duration:2e3})}))}}))},openDelConfirm:function(t){return this.$confirm("此操作将删除 ".concat(t,", 是否继续?"),"提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"})},handleDelete:function(t){var e=this;this.openDelConfirm(t.tenantId).then((function(){l["b"](t.tenantId).then((function(t){e.fetchData(),e.$notify({title:"Success",message:"Delete Successfully",type:"success",duration:2e3})}))}))}}},u=s,c=n("2877"),d=Object(c["a"])(u,a,i,!1,null,null,null);e["default"]=d.exports},6724:function(t,e,n){"use strict";n("8d41");var a="@@wavesContext";function i(t,e){function n(n){var a=Object.assign({},e.value),i=Object.assign({ele:t,type:"hit",color:"rgba(0, 0, 0, 0.15)"},a),l=i.ele;if(l){l.style.position="relative",l.style.overflow="hidden";var o=l.getBoundingClientRect(),r=l.querySelector(".waves-ripple");switch(r?r.className="waves-ripple":(r=document.createElement("span"),r.className="waves-ripple",r.style.height=r.style.width=Math.max(o.width,o.height)+"px",l.appendChild(r)),i.type){case"center":r.style.top=o.height/2-r.offsetHeight/2+"px",r.style.left=o.width/2-r.offsetWidth/2+"px";break;default:r.style.top=(n.pageY-o.top-r.offsetHeight/2-document.documentElement.scrollTop||document.body.scrollTop)+"px",r.style.left=(n.pageX-o.left-r.offsetWidth/2-document.documentElement.scrollLeft||document.body.scrollLeft)+"px"}return r.style.backgroundColor=i.color,r.className="waves-ripple z-active",!1}}return t[a]?t[a].removeHandle=n:t[a]={removeHandle:n},n}var l={bind:function(t,e){t.addEventListener("click",i(t,e),!1)},update:function(t,e){t.removeEventListener("click",t[a].removeHandle,!1),t.addEventListener("click",i(t,e),!1)},unbind:function(t){t.removeEventListener("click",t[a].removeHandle,!1),t[a]=null,delete t[a]}},o=function(t){t.directive("waves",l)};window.Vue&&(window.waves=l,Vue.use(o)),l.install=o;e["a"]=l},7456:function(t,e,n){},"8d41":function(t,e,n){},dd71:function(t,e,n){"use strict";n.d(e,"c",(function(){return i})),n.d(e,"d",(function(){return l})),n.d(e,"a",(function(){return o})),n.d(e,"b",(function(){return r}));var a=n("b775");function i(t){return Object(a["a"])({url:"/hippo4j/v1/cs/tenant/query/page",method:"post",data:t})}function l(t){return Object(a["a"])({url:"/hippo4j/v1/cs/tenant/update",method:"post",data:t})}function o(t){return Object(a["a"])({url:"/hippo4j/v1/cs/tenant/save",method:"post",data:t})}function r(t){return Object(a["a"])({url:"/hippo4j/v1/cs/tenant/delete/"+t,method:"delete"})}},e498:function(t,e,n){"use strict";n("7456")}}]); \ No newline at end of file diff --git a/hippo4j-console/src/main/resources/static/static/js/chunk-e25b23da.15e2c94d.js b/hippo4j-console/src/main/resources/static/static/js/chunk-e25b23da.15e2c94d.js deleted file mode 100644 index c3b31d7f..00000000 --- a/hippo4j-console/src/main/resources/static/static/js/chunk-e25b23da.15e2c94d.js +++ /dev/null @@ -1 +0,0 @@ -(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-e25b23da"],{"333d":function(e,t,n){"use strict";var i=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"pagination-container",class:{hidden:e.hidden}},[n("el-pagination",e._b({attrs:{background:e.background,"current-page":e.currentPage,"page-size":e.pageSize,layout:e.layout,"page-sizes":e.pageSizes,total:e.total},on:{"update:currentPage":function(t){e.currentPage=t},"update:current-page":function(t){e.currentPage=t},"update:pageSize":function(t){e.pageSize=t},"update:page-size":function(t){e.pageSize=t},"size-change":e.handleSizeChange,"current-change":e.handleCurrentChange}},"el-pagination",e.$attrs,!1))],1)},a=[];n("c5f6");Math.easeInOutQuad=function(e,t,n,i){return e/=i/2,e<1?n/2*e*e+t:(e--,-n/2*(e*(e-2)-1)+t)};var l=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(e){window.setTimeout(e,1e3/60)}}();function r(e){document.documentElement.scrollTop=e,document.body.parentNode.scrollTop=e,document.body.scrollTop=e}function o(){return document.documentElement.scrollTop||document.body.parentNode.scrollTop||document.body.scrollTop}function s(e,t,n){var i=o(),a=e-i,s=20,u=0;t="undefined"===typeof t?500:t;var c=function e(){u+=s;var o=Math.easeInOutQuad(u,i,a,t);r(o),u0,expression:"total>0"}],attrs:{total:e.total,page:e.listQuery.current,limit:e.listQuery.size},on:{"update:page":function(t){return e.$set(e.listQuery,"current",t)},"update:limit":function(t){return e.$set(e.listQuery,"size",t)},pagination:e.fetchData}}),e._v(" "),n("el-dialog",{attrs:{title:e.textMap[e.dialogStatus],visible:e.dialogFormVisible,width:"800px"},on:{"update:visible":function(t){e.dialogFormVisible=t}}},[n("el-form",{ref:"dataForm",attrs:{rules:e.rules,model:e.temp,"label-position":"left","label-width":"100px"}},[n("el-form-item",{attrs:{label:"租户ID",prop:"tenantId"}},[n("el-select",{staticClass:"filter-item",staticStyle:{width:"40%"},attrs:{placeholder:"租户ID",filterable:"",clearable:"",disabled:"create"!==e.dialogStatus},model:{value:e.temp.tenantId,callback:function(t){e.$set(e.temp,"tenantId",t)},expression:"temp.tenantId"}},e._l(e.tenantOptions,(function(e){return n("el-option",{key:e.key,attrs:{label:e.display_name,value:e.key}})})),1)],1),e._v(" "),n("el-form-item",{attrs:{label:"项目ID",prop:"itemId"}},[n("el-input",{staticStyle:{width:"40%"},attrs:{disabled:"create"!==e.dialogStatus,placeholder:"项目ID"},model:{value:e.temp.itemId,callback:function(t){e.$set(e.temp,"itemId",t)},expression:"temp.itemId"}})],1),e._v(" "),n("el-form-item",{attrs:{label:"项目名称",prop:"itemName"}},[n("el-input",{staticStyle:{width:"40%"},attrs:{placeholder:"项目名称"},model:{value:e.temp.itemName,callback:function(t){e.$set(e.temp,"itemName",t)},expression:"temp.itemName"}})],1),e._v(" "),n("el-form-item",{attrs:{label:"OWNER",prop:"owner"}},[n("el-input",{staticStyle:{width:"40%"},attrs:{placeholder:"OWNER"},model:{value:e.temp.owner,callback:function(t){e.$set(e.temp,"owner",t)},expression:"temp.owner"}})],1),e._v(" "),n("el-form-item",{attrs:{label:"项目描述",prop:"itemDesc"}},[n("el-input",{staticStyle:{width:"40%"},attrs:{autosize:{minRows:3,maxRows:6},type:"textarea",placeholder:"项目描述"},model:{value:e.temp.itemDesc,callback:function(t){e.$set(e.temp,"itemDesc",t)},expression:"temp.itemDesc"}})],1)],1),e._v(" "),n("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[n("el-button",{on:{click:function(t){e.dialogFormVisible=!1}}},[e._v("\n 取消\n ")]),e._v(" "),n("el-button",{attrs:{type:"primary"},on:{click:function(t){"create"===e.dialogStatus?e.createData():e.updateData()}}},[e._v("\n 确认\n ")])],1)],1),e._v(" "),n("el-dialog",{attrs:{visible:e.dialogPluginVisible,title:"Reading statistics"},on:{"update:visible":function(t){e.dialogPluginVisible=t}}},[n("el-table",{staticStyle:{width:"100%"},attrs:{data:e.pluginData,border:"",fit:"","highlight-current-row":""}},[n("el-table-column",{attrs:{prop:"key",label:"Channel"}}),e._v(" "),n("el-table-column",{attrs:{prop:"pv",label:"Pv"}})],1),e._v(" "),n("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[n("el-button",{attrs:{type:"primary"},on:{click:function(t){e.dialogPvVisible=!1}}},[e._v("Confirm")])],1)],1)],1)},a=[],l=n("3737"),r=n("dd71"),o=n("6724"),s=n("333d"),u={name:"JobProject",components:{Pagination:s["a"]},directives:{waves:o["a"]},filters:{statusFilter:function(e){var t={published:"success",draft:"gray",deleted:"danger"};return t[e]},ellipsis:function(e){return e?e.length>26?e.slice(0,26)+"...":e:""}},data:function(){return{list:null,listLoading:!0,total:0,listQuery:{current:1,size:10,itemId:""},pluginTypeOptions:["reader","writer"],dialogPluginVisible:!1,pluginData:[],dialogFormVisible:!1,tenantOptions:[],dialogStatus:"",textMap:{update:"Edit",create:"Create"},rules:{tenantId:[{required:!0,message:"this is required",trigger:"blur"}],itemId:[{required:!0,message:"this is required",trigger:"blur"}],itemName:[{required:!0,message:"this is required",trigger:"blur"}],owner:[{required:!0,message:"this is required",trigger:"blur"}],itemDesc:[{required:!0,message:"this is required",trigger:"blur"}]},temp:{id:void 0,tenantId:"",tenantName:"",owner:"",tenantDesc:""},visible:!0}},created:function(){this.fetchData(),this.initSelect()},methods:{fetchData:function(){var e=this;this.listLoading=!0,l["c"](this.listQuery).then((function(t){var n=t.records,i=t.total;e.total=i,e.list=n,e.listLoading=!1}))},initSelect:function(){var e=this;r["c"]({}).then((function(t){for(var n=t.records,i=0;i0,expression:"total>0"}],attrs:{total:e.total,page:e.listQuery.current,limit:e.listQuery.size},on:{"update:page":function(t){return e.$set(e.listQuery,"current",t)},"update:limit":function(t){return e.$set(e.listQuery,"size",t)},pagination:e.fetchData}}),e._v(" "),n("el-dialog",{attrs:{title:e.textMap[e.dialogStatus],visible:e.dialogFormVisible,width:"800px"},on:{"update:visible":function(t){e.dialogFormVisible=t}}},[n("el-form",{ref:"dataForm",attrs:{rules:e.rules,model:e.temp,"label-position":"left","label-width":"100px"}},[n("el-form-item",{attrs:{label:"租户ID",prop:"tenantId"}},[n("el-select",{staticClass:"filter-item",staticStyle:{width:"40%"},attrs:{placeholder:"租户ID",filterable:"",clearable:"",disabled:"create"!==e.dialogStatus},model:{value:e.temp.tenantId,callback:function(t){e.$set(e.temp,"tenantId",t)},expression:"temp.tenantId"}},e._l(e.tenantOptions,(function(e){return n("el-option",{key:e.key,attrs:{label:e.display_name,value:e.key}})})),1)],1),e._v(" "),n("el-form-item",{attrs:{label:"项目ID",prop:"itemId"}},[n("el-input",{staticStyle:{width:"40%"},attrs:{disabled:"create"!==e.dialogStatus,placeholder:"项目ID"},model:{value:e.temp.itemId,callback:function(t){e.$set(e.temp,"itemId",t)},expression:"temp.itemId"}})],1),e._v(" "),n("el-form-item",{attrs:{label:"项目名称",prop:"itemName"}},[n("el-input",{staticStyle:{width:"40%"},attrs:{placeholder:"项目名称"},model:{value:e.temp.itemName,callback:function(t){e.$set(e.temp,"itemName",t)},expression:"temp.itemName"}})],1),e._v(" "),n("el-form-item",{attrs:{label:"OWNER",prop:"owner"}},[n("el-input",{staticStyle:{width:"40%"},attrs:{placeholder:"OWNER"},model:{value:e.temp.owner,callback:function(t){e.$set(e.temp,"owner",t)},expression:"temp.owner"}})],1),e._v(" "),n("el-form-item",{attrs:{label:"项目描述",prop:"itemDesc"}},[n("el-input",{staticStyle:{width:"40%"},attrs:{autosize:{minRows:3,maxRows:6},type:"textarea",placeholder:"项目描述"},model:{value:e.temp.itemDesc,callback:function(t){e.$set(e.temp,"itemDesc",t)},expression:"temp.itemDesc"}})],1)],1),e._v(" "),n("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[n("el-button",{on:{click:function(t){e.dialogFormVisible=!1}}},[e._v("\n 取消\n ")]),e._v(" "),n("el-button",{attrs:{type:"primary"},on:{click:function(t){"create"===e.dialogStatus?e.createData():e.updateData()}}},[e._v("\n 确认\n ")])],1)],1),e._v(" "),n("el-dialog",{attrs:{visible:e.dialogPluginVisible,title:"Reading statistics"},on:{"update:visible":function(t){e.dialogPluginVisible=t}}},[n("el-table",{staticStyle:{width:"100%"},attrs:{data:e.pluginData,border:"",fit:"","highlight-current-row":""}},[n("el-table-column",{attrs:{prop:"key",label:"Channel"}}),e._v(" "),n("el-table-column",{attrs:{prop:"pv",label:"Pv"}})],1),e._v(" "),n("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[n("el-button",{attrs:{type:"primary"},on:{click:function(t){e.dialogPvVisible=!1}}},[e._v("Confirm")])],1)],1)],1)},a=[],l=n("3737"),r=n("dd71"),o=n("6724"),s=n("333d"),u={name:"JobProject",components:{Pagination:s["a"]},directives:{waves:o["a"]},filters:{statusFilter:function(e){var t={published:"success",draft:"gray",deleted:"danger"};return t[e]},ellipsis:function(e){return e?e.length>26?e.slice(0,26)+"...":e:""}},data:function(){return{list:null,listLoading:!0,total:0,listQuery:{current:1,size:10,itemId:""},pluginTypeOptions:["reader","writer"],dialogPluginVisible:!1,pluginData:[],dialogFormVisible:!1,tenantOptions:[],dialogStatus:"",isEditDisabled:!1,textMap:{update:"Edit",create:"Create"},rules:{tenantId:[{required:!0,message:"this is required",trigger:"blur"}],itemId:[{required:!0,message:"this is required",trigger:"blur"}],itemName:[{required:!0,message:"this is required",trigger:"blur"}],owner:[{required:!0,message:"this is required",trigger:"blur"}],itemDesc:[{required:!0,message:"this is required",trigger:"blur"}]},temp:{id:void 0,tenantId:"",tenantName:"",owner:"",tenantDesc:""},visible:!0}},created:function(){this.fetchData(),this.initSelect()},mounted:function(){this.isEditDisabled="admin"!==this.$cookie.get("userName")},methods:{fetchData:function(){var e=this;this.listLoading=!0,l["c"](this.listQuery).then((function(t){var n=t.records,i=t.total;e.total=i,e.list=n,e.listLoading=!1}))},initSelect:function(){var e=this;r["c"]({}).then((function(t){for(var n=t.records,i=0;i Date: Mon, 28 Feb 2022 21:33:59 +0800 Subject: [PATCH 2/3] =?UTF-8?q?Web=20Pool=20=E7=9B=B8=E5=85=B3=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E6=A0=BC=E5=BC=8F=E8=B0=83=E6=95=B4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../starter/config/DynamicThreadPoolAutoConfiguration.java | 4 ++-- .../starter/handler/web/AbstractWebThreadPoolService.java | 1 - .../starter/handler/web/JettyWebThreadPoolHandler.java | 7 ++----- .../starter/handler/web/TomcatWebThreadPoolHandler.java | 7 +++---- .../starter/handler/web/UndertowWebThreadPoolHandler.java | 1 - 5 files changed, 7 insertions(+), 13 deletions(-) diff --git a/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/starter/config/DynamicThreadPoolAutoConfiguration.java b/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/starter/config/DynamicThreadPoolAutoConfiguration.java index 30ae05f0..475e5a83 100644 --- a/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/starter/config/DynamicThreadPoolAutoConfiguration.java +++ b/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/starter/config/DynamicThreadPoolAutoConfiguration.java @@ -152,7 +152,8 @@ public class DynamicThreadPoolAutoConfiguration { @Bean @ConditionalOnBean(name = JETTY_SERVLET_WEB_SERVER_FACTORY) - public JettyWebThreadPoolHandler jettyWebThreadPoolHandler() {return new JettyWebThreadPoolHandler(); + public JettyWebThreadPoolHandler jettyWebThreadPoolHandler() { + return new JettyWebThreadPoolHandler(); } @Bean @@ -161,7 +162,6 @@ public class DynamicThreadPoolAutoConfiguration { return new UndertowWebThreadPoolHandler(); } - @Bean public WebThreadPoolHandlerChoose webThreadPoolServiceChoose() { return new WebThreadPoolHandlerChoose(); diff --git a/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/starter/handler/web/AbstractWebThreadPoolService.java b/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/starter/handler/web/AbstractWebThreadPoolService.java index 0ef2bab4..ef98c34f 100644 --- a/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/starter/handler/web/AbstractWebThreadPoolService.java +++ b/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/starter/handler/web/AbstractWebThreadPoolService.java @@ -44,5 +44,4 @@ public abstract class AbstractWebThreadPoolService implements WebThreadPoolServi return executor; } - } diff --git a/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/starter/handler/web/JettyWebThreadPoolHandler.java b/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/starter/handler/web/JettyWebThreadPoolHandler.java index 0bf43750..6a5d9d9f 100644 --- a/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/starter/handler/web/JettyWebThreadPoolHandler.java +++ b/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/starter/handler/web/JettyWebThreadPoolHandler.java @@ -14,9 +14,7 @@ import java.util.concurrent.Executor; * @description: */ @Slf4j -public class JettyWebThreadPoolHandler extends AbstractWebThreadPoolService{ - - +public class JettyWebThreadPoolHandler extends AbstractWebThreadPoolService { @Override protected Executor getWebThreadPoolByServer(WebServer webServer) { @@ -33,6 +31,7 @@ public class JettyWebThreadPoolHandler extends AbstractWebThreadPoolService{ Integer maxSize = poolParameterInfo.getMaxSize(); jettyExecutor.setMinThreads(coreSize); jettyExecutor.setMaxThreads(maxSize); + log.info( "🔥 Changed web thread pool. coreSize :: [{}], maxSize :: [{}]", String.format("%s => %s", jettyExecutor.getMinThreads(), coreSize), @@ -41,8 +40,6 @@ public class JettyWebThreadPoolHandler extends AbstractWebThreadPoolService{ } catch (Exception ex) { log.error("Failed to modify the jetty thread pool parameter.", ex); } - } - } diff --git a/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/starter/handler/web/TomcatWebThreadPoolHandler.java b/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/starter/handler/web/TomcatWebThreadPoolHandler.java index d47ebb9c..7aa8ba7e 100644 --- a/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/starter/handler/web/TomcatWebThreadPoolHandler.java +++ b/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/starter/handler/web/TomcatWebThreadPoolHandler.java @@ -19,8 +19,7 @@ import java.util.concurrent.atomic.AtomicBoolean; */ @Slf4j @AllArgsConstructor -public class TomcatWebThreadPoolHandler extends AbstractWebThreadPoolService{ - +public class TomcatWebThreadPoolHandler extends AbstractWebThreadPoolService { private final AtomicBoolean cacheFlag = new AtomicBoolean(Boolean.FALSE); @@ -52,17 +51,17 @@ public class TomcatWebThreadPoolHandler extends AbstractWebThreadPoolService{ tomcatExecutor.setCorePoolSize(poolParameterInfo.getCoreSize()); tomcatExecutor.setMaximumPoolSize(poolParameterInfo.getMaxSize()); tomcatExecutor.setKeepAliveTime(poolParameterInfo.getKeepAliveTime(), TimeUnit.SECONDS); + int originalCoreSize = tomcatExecutor.getCorePoolSize(); int originalMaximumPoolSize = tomcatExecutor.getMaximumPoolSize(); long originalKeepAliveTime = tomcatExecutor.getKeepAliveTime(TimeUnit.SECONDS); + log.info( "🔥 Changed web thread pool. coreSize :: [{}], maxSize :: [{}], keepAliveTime :: [{}]", String.format("%s => %s", originalCoreSize, poolParameterInfo.getCoreSize()), String.format("%s => %s", originalMaximumPoolSize, poolParameterInfo.getMaxSize()), String.format("%s => %s", originalKeepAliveTime, poolParameterInfo.getKeepAliveTime()) ); - - } catch (Exception ex) { log.error("Failed to modify the Tomcat thread pool parameter.", ex); } diff --git a/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/starter/handler/web/UndertowWebThreadPoolHandler.java b/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/starter/handler/web/UndertowWebThreadPoolHandler.java index 618b1d24..808664a4 100644 --- a/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/starter/handler/web/UndertowWebThreadPoolHandler.java +++ b/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/starter/handler/web/UndertowWebThreadPoolHandler.java @@ -60,7 +60,6 @@ public class UndertowWebThreadPoolHandler extends AbstractWebThreadPoolService { } catch (Exception ex) { log.error("Failed to modify the undertow thread pool parameter.", ex); } - } } From dfc7f0eab146c4ac2a43e4012fe1dcb6635430b3 Mon Sep 17 00:00:00 2001 From: Serenity <1360359624@qq.com> Date: Mon, 28 Feb 2022 22:56:20 +0800 Subject: [PATCH 3/3] =?UTF-8?q?[code]=E5=AE=8C=E6=88=90nacos=E9=80=82?= =?UTF-8?q?=E9=85=8D=E8=A7=A3=E6=9E=90properties=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ynamicThreadPoolCoreAutoConfiguration.java | 31 ++++++++++--- .../AbstractCoreThreadPoolDynamicRefresh.java | 5 ++- .../refresher/ConfigParserHandler.java | 44 ------------------- .../refresher/NacosCloudRefresherHandler.java | 5 ++- .../refresher/NacosRefresherHandler.java | 5 ++- .../refresher/config/ConfigParser.java | 18 ++++++++ .../config/impl/PropConfigParser.java | 37 ++++++++++++++++ .../config/impl/YmlConfigParser.java | 32 ++++++++++++++ 8 files changed, 120 insertions(+), 57 deletions(-) delete mode 100644 hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/starter/refresher/ConfigParserHandler.java create mode 100644 hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/starter/refresher/config/ConfigParser.java create mode 100644 hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/starter/refresher/config/impl/PropConfigParser.java create mode 100644 hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/starter/refresher/config/impl/YmlConfigParser.java diff --git a/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/starter/config/DynamicThreadPoolCoreAutoConfiguration.java b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/starter/config/DynamicThreadPoolCoreAutoConfiguration.java index fd2818c9..dc5aba1d 100644 --- a/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/starter/config/DynamicThreadPoolCoreAutoConfiguration.java +++ b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/starter/config/DynamicThreadPoolCoreAutoConfiguration.java @@ -12,12 +12,15 @@ import cn.hippo4j.common.notify.platform.WeChatSendMessageHandler; import cn.hippo4j.core.config.UtilAutoConfiguration; import cn.hippo4j.core.executor.ThreadPoolNotifyAlarmHandler; import cn.hippo4j.core.starter.notify.CoreNotifyConfigBuilder; -import cn.hippo4j.core.starter.refresher.ConfigParserHandler; import cn.hippo4j.core.starter.refresher.NacosCloudRefresherHandler; import cn.hippo4j.core.starter.refresher.NacosRefresherHandler; +import cn.hippo4j.core.starter.refresher.config.ConfigParser; +import cn.hippo4j.core.starter.refresher.config.impl.PropConfigParser; +import cn.hippo4j.core.starter.refresher.config.impl.YmlConfigParser; import cn.hippo4j.core.starter.support.DynamicThreadPoolPostProcessor; import com.alibaba.cloud.nacos.NacosConfigManager; import com.alibaba.nacos.api.config.ConfigService; +import com.google.common.collect.Lists; import lombok.AllArgsConstructor; import org.springframework.boot.autoconfigure.ImportAutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; @@ -28,6 +31,8 @@ import org.springframework.context.annotation.Configuration; import org.springframework.core.Ordered; import org.springframework.core.annotation.Order; +import java.util.List; + /** * Dynamic thread pool auto configuration. * @@ -46,6 +51,9 @@ public class DynamicThreadPoolCoreAutoConfiguration { private static final String NACOS_CONFIG_KEY = "com.alibaba.nacos.api.config"; + private final List yamlList = Lists.newArrayList("yaml", "yml"); + private final List propList = Lists.newArrayList("properties"); + @Bean @Order(Ordered.HIGHEST_PRECEDENCE) public ApplicationContextHolder hippo4JApplicationContextHolder() { @@ -98,23 +106,32 @@ public class DynamicThreadPoolCoreAutoConfiguration { @ConditionalOnMissingClass(NACOS_CONFIG_MANAGER_KEY) public NacosRefresherHandler nacosRefresherHandler(ConfigService configService, ThreadPoolNotifyAlarmHandler threadPoolNotifyAlarmHandler, - ConfigParserHandler configParserHandler, + ConfigParser configParser, BootstrapCoreProperties bootstrapCoreProperties) { - return new NacosRefresherHandler(configService, threadPoolNotifyAlarmHandler, configParserHandler, bootstrapCoreProperties); + return new NacosRefresherHandler(configService, threadPoolNotifyAlarmHandler, configParser, bootstrapCoreProperties); } @Bean @ConditionalOnClass(name = NACOS_CONFIG_MANAGER_KEY) public NacosCloudRefresherHandler nacosCloudRefresherHandler(NacosConfigManager nacosConfigManager, ThreadPoolNotifyAlarmHandler threadPoolNotifyAlarmHandler, - ConfigParserHandler configParserHandler, + ConfigParser configParser, BootstrapCoreProperties bootstrapCoreProperties) { - return new NacosCloudRefresherHandler(nacosConfigManager, threadPoolNotifyAlarmHandler, configParserHandler, bootstrapCoreProperties); + return new NacosCloudRefresherHandler(nacosConfigManager, threadPoolNotifyAlarmHandler, configParser, bootstrapCoreProperties); } @Bean - public ConfigParserHandler configParserHandler() { - return new ConfigParserHandler(); + public ConfigParser configParserHandler() { + // return new ConfigParserHandler(); + String configFileType = bootstrapCoreProperties.getConfigFileType(); + if (yamlList.contains(configFileType)) { + return new YmlConfigParser(); + } + if (propList.contains(configFileType)) { + return new PropConfigParser(); + } + + throw new UnsupportedOperationException("暂不支持的配置文件类型: " + configFileType); } } diff --git a/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/starter/refresher/AbstractCoreThreadPoolDynamicRefresh.java b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/starter/refresher/AbstractCoreThreadPoolDynamicRefresh.java index 03465998..4267c261 100644 --- a/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/starter/refresher/AbstractCoreThreadPoolDynamicRefresh.java +++ b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/starter/refresher/AbstractCoreThreadPoolDynamicRefresh.java @@ -9,6 +9,7 @@ import cn.hippo4j.core.executor.support.*; import cn.hippo4j.core.proxy.RejectedProxyUtil; import cn.hippo4j.core.starter.config.BootstrapCoreProperties; import cn.hippo4j.core.starter.config.ExecutorProperties; +import cn.hippo4j.core.starter.refresher.config.ConfigParser; import cn.hippo4j.core.starter.support.GlobalCoreThreadPoolManage; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -40,7 +41,7 @@ public abstract class AbstractCoreThreadPoolDynamicRefresh implements ThreadPool private final ThreadPoolNotifyAlarmHandler threadPoolNotifyAlarmHandler; - private final ConfigParserHandler configParserHandler; + private final ConfigParser configParser; protected final BootstrapCoreProperties bootstrapCoreProperties; @@ -51,7 +52,7 @@ public abstract class AbstractCoreThreadPoolDynamicRefresh implements ThreadPool @Override public void dynamicRefresh(String content) { - Map configInfo = configParserHandler.parseConfig(content, bootstrapCoreProperties.getConfigFileType()); + Map configInfo = configParser.parseConfig(content); ConfigurationPropertySource sources = new MapConfigurationPropertySource(configInfo); Binder binder = new Binder(sources); diff --git a/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/starter/refresher/ConfigParserHandler.java b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/starter/refresher/ConfigParserHandler.java deleted file mode 100644 index 320579fe..00000000 --- a/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/starter/refresher/ConfigParserHandler.java +++ /dev/null @@ -1,44 +0,0 @@ -package cn.hippo4j.core.starter.refresher; - -import cn.hippo4j.common.toolkit.StringUtil; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import org.springframework.beans.factory.config.YamlPropertiesFactoryBean; -import org.springframework.core.io.ByteArrayResource; - -import java.util.List; -import java.util.Map; - -/** - * Config parser service. - * - * @author chen.ma - * @date 2022/2/26 17:33 - */ -public class ConfigParserHandler { - - private final List yamlList = Lists.newArrayList("yaml", "yml"); - - /** - * Parse config. - * - * @param content - * @param configFileType - * @return - */ - public Map parseConfig(String content, String configFileType) { - Map resultMap = Maps.newHashMap(); - if (StringUtil.isBlank(content)) { - return resultMap; - } - - if (yamlList.contains(configFileType)) { - YamlPropertiesFactoryBean yamlPropertiesFactoryBean = new YamlPropertiesFactoryBean(); - yamlPropertiesFactoryBean.setResources(new ByteArrayResource(content.getBytes())); - resultMap = yamlPropertiesFactoryBean.getObject(); - } - - return resultMap; - } - -} diff --git a/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/starter/refresher/NacosCloudRefresherHandler.java b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/starter/refresher/NacosCloudRefresherHandler.java index d226c632..954fce04 100644 --- a/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/starter/refresher/NacosCloudRefresherHandler.java +++ b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/starter/refresher/NacosCloudRefresherHandler.java @@ -2,6 +2,7 @@ package cn.hippo4j.core.starter.refresher; import cn.hippo4j.core.executor.ThreadPoolNotifyAlarmHandler; import cn.hippo4j.core.starter.config.BootstrapCoreProperties; +import cn.hippo4j.core.starter.refresher.config.ConfigParser; import com.alibaba.cloud.nacos.NacosConfigManager; import com.alibaba.nacos.api.config.listener.Listener; import lombok.extern.slf4j.Slf4j; @@ -23,9 +24,9 @@ public class NacosCloudRefresherHandler extends AbstractCoreThreadPoolDynamicRef public NacosCloudRefresherHandler(NacosConfigManager nacosConfigManager, ThreadPoolNotifyAlarmHandler threadPoolNotifyAlarmHandler, - ConfigParserHandler configParserHandler, + ConfigParser configParser, BootstrapCoreProperties bootstrapCoreProperties) { - super(threadPoolNotifyAlarmHandler, configParserHandler, bootstrapCoreProperties); + super(threadPoolNotifyAlarmHandler, configParser, bootstrapCoreProperties); this.nacosConfigManager = nacosConfigManager; } diff --git a/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/starter/refresher/NacosRefresherHandler.java b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/starter/refresher/NacosRefresherHandler.java index db4fe271..37262ebb 100644 --- a/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/starter/refresher/NacosRefresherHandler.java +++ b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/starter/refresher/NacosRefresherHandler.java @@ -2,6 +2,7 @@ package cn.hippo4j.core.starter.refresher; import cn.hippo4j.core.executor.ThreadPoolNotifyAlarmHandler; import cn.hippo4j.core.starter.config.BootstrapCoreProperties; +import cn.hippo4j.core.starter.refresher.config.ConfigParser; import com.alibaba.nacos.api.config.ConfigService; import com.alibaba.nacos.api.config.listener.Listener; import lombok.extern.slf4j.Slf4j; @@ -23,9 +24,9 @@ public class NacosRefresherHandler extends AbstractCoreThreadPoolDynamicRefresh public NacosRefresherHandler(ConfigService configService, ThreadPoolNotifyAlarmHandler threadPoolNotifyAlarmHandler, - ConfigParserHandler configParserHandler, + ConfigParser configParser, BootstrapCoreProperties bootstrapCoreProperties) { - super(threadPoolNotifyAlarmHandler, configParserHandler, bootstrapCoreProperties); + super(threadPoolNotifyAlarmHandler, configParser, bootstrapCoreProperties); this.configService = configService; } diff --git a/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/starter/refresher/config/ConfigParser.java b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/starter/refresher/config/ConfigParser.java new file mode 100644 index 00000000..80fb2514 --- /dev/null +++ b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/starter/refresher/config/ConfigParser.java @@ -0,0 +1,18 @@ +package cn.hippo4j.core.starter.refresher.config; + +import java.util.Map; + +/** + * 配置序列化接口 + * + * @author serenity SerenitySir@outlook.com + * @since 2022/2/28 + */ +public interface ConfigParser { + /** + * 对配置进行序列化 + * @param content 配置的字符串形式 + * @return 序列化后的k,v + */ + Map parseConfig(String content); +} diff --git a/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/starter/refresher/config/impl/PropConfigParser.java b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/starter/refresher/config/impl/PropConfigParser.java new file mode 100644 index 00000000..8f10b759 --- /dev/null +++ b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/starter/refresher/config/impl/PropConfigParser.java @@ -0,0 +1,37 @@ +package cn.hippo4j.core.starter.refresher.config.impl; + +import cn.hippo4j.core.starter.refresher.config.ConfigParser; +import com.google.common.collect.Maps; +import lombok.SneakyThrows; +import org.springframework.util.StringUtils; + +import java.io.StringReader; +import java.util.Map; +import java.util.Properties; + +/** + * Properties序列化配置 + * + * @author serenity SerenitySir@outlook.com + * @since 2022/2/28 + */ +public class PropConfigParser implements ConfigParser { + + @SneakyThrows + @Override + public Map parseConfig(String content) { + if (!StringUtils.hasText(content)){ + return Maps.newHashMap(); + } + + Properties properties = new Properties(); + properties.load(new StringReader(content)); + return properties; + } + + public static void main(String[] args) { + ConfigParser propConfigParser = new PropConfigParser(); + Map map = propConfigParser.parseConfig("db.aa=11\ndb.bb=22"); + System.out.println(map.toString()); + } +} diff --git a/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/starter/refresher/config/impl/YmlConfigParser.java b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/starter/refresher/config/impl/YmlConfigParser.java new file mode 100644 index 00000000..af7a7ad4 --- /dev/null +++ b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/starter/refresher/config/impl/YmlConfigParser.java @@ -0,0 +1,32 @@ +package cn.hippo4j.core.starter.refresher.config.impl; + +import cn.hippo4j.common.toolkit.StringUtil; +import cn.hippo4j.core.starter.refresher.config.ConfigParser; +import com.google.common.collect.Maps; +import org.springframework.beans.factory.config.YamlPropertiesFactoryBean; +import org.springframework.core.io.ByteArrayResource; + +import java.util.Map; + +/** + * Yml序列化配置 + * + * @author serenity SerenitySir@outlook.com + * @since 2022/2/28 + */ +public class YmlConfigParser implements ConfigParser { + + @Override + public Map parseConfig(String content) { + Map resultMap = Maps.newHashMap(); + if (StringUtil.isBlank(content)) { + return resultMap; + } + + YamlPropertiesFactoryBean yamlPropertiesFactoryBean = new YamlPropertiesFactoryBean(); + yamlPropertiesFactoryBean.setResources(new ByteArrayResource(content.getBytes())); + resultMap = yamlPropertiesFactoryBean.getObject(); + + return resultMap; + } +}