diff --git a/package-lock.json b/package-lock.json index 267c0020c..9157e3cd1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2377,6 +2377,12 @@ } } }, + "base16": { + "version": "1.0.0", + "resolved": "https://registry.npm.taobao.org/base16/download/base16-1.0.0.tgz", + "integrity": "sha1-4pf2DX7BAUp6lxo568ipjAtoHnA=", + "dev": true + }, "base64-js": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz", @@ -3869,6 +3875,23 @@ "warning": "^4.0.3" } }, + "cross-fetch": { + "version": "3.1.4", + "resolved": "https://registry.nlark.com/cross-fetch/download/cross-fetch-3.1.4.tgz", + "integrity": "sha1-lyPzo6JHv4uJA586OAqSROj6Lzk=", + "dev": true, + "requires": { + "node-fetch": "2.6.1" + }, + "dependencies": { + "node-fetch": { + "version": "2.6.1", + "resolved": "https://registry.nlark.com/node-fetch/download/node-fetch-2.6.1.tgz?cache=0&sync_timestamp=1626684741221&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fnode-fetch%2Fdownload%2Fnode-fetch-2.6.1.tgz", + "integrity": "sha1-BFvTI2Mfdu0uK1VXM5RBa2OaAFI=", + "dev": true + } + } + }, "cross-spawn": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", @@ -6214,6 +6237,41 @@ "bser": "2.1.1" } }, + "fbemitter": { + "version": "3.0.0", + "resolved": "https://registry.npm.taobao.org/fbemitter/download/fbemitter-3.0.0.tgz", + "integrity": "sha1-ALKhr1QRJUqrQWzXX55iib7kv/M=", + "dev": true, + "requires": { + "fbjs": "^3.0.0" + }, + "dependencies": { + "fbjs": { + "version": "3.0.0", + "resolved": "https://registry.npm.taobao.org/fbjs/download/fbjs-3.0.0.tgz?cache=0&sync_timestamp=1602048313843&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ffbjs%2Fdownload%2Ffbjs-3.0.0.tgz", + "integrity": "sha1-CQcGf7P1enj0XZXx6s/8rNYjwWU=", + "dev": true, + "requires": { + "cross-fetch": "^3.0.4", + "fbjs-css-vars": "^1.0.0", + "loose-envify": "^1.0.0", + "object-assign": "^4.1.0", + "promise": "^7.1.1", + "setimmediate": "^1.0.5", + "ua-parser-js": "^0.7.18" + } + }, + "promise": { + "version": "7.3.1", + "resolved": "https://registry.npm.taobao.org/promise/download/promise-7.3.1.tgz", + "integrity": "sha1-BktyYCsY+Q8pGSuLG8QY/9Hr078=", + "dev": true, + "requires": { + "asap": "~2.0.3" + } + } + } + }, "fbjs": { "version": "0.8.17", "resolved": "https://registry.npmjs.org/fbjs/-/fbjs-0.8.17.tgz", @@ -6243,6 +6301,12 @@ } } }, + "fbjs-css-vars": { + "version": "1.0.2", + "resolved": "https://registry.npm.taobao.org/fbjs-css-vars/download/fbjs-css-vars-1.0.2.tgz", + "integrity": "sha1-IWVRE2rgL+JVkyw+yHdfGOLAeLg=", + "dev": true + }, "fecha": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/fecha/-/fecha-2.3.3.tgz", @@ -6687,6 +6751,42 @@ "readable-stream": "^2.3.6" } }, + "flux": { + "version": "4.0.1", + "resolved": "https://registry.npm.taobao.org/flux/download/flux-4.0.1.tgz", + "integrity": "sha1-eENQKwKEHUqqU0rws3MDSh917lw=", + "dev": true, + "requires": { + "fbemitter": "^3.0.0", + "fbjs": "^3.0.0" + }, + "dependencies": { + "fbjs": { + "version": "3.0.0", + "resolved": "https://registry.npm.taobao.org/fbjs/download/fbjs-3.0.0.tgz?cache=0&sync_timestamp=1602048313843&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ffbjs%2Fdownload%2Ffbjs-3.0.0.tgz", + "integrity": "sha1-CQcGf7P1enj0XZXx6s/8rNYjwWU=", + "dev": true, + "requires": { + "cross-fetch": "^3.0.4", + "fbjs-css-vars": "^1.0.0", + "loose-envify": "^1.0.0", + "object-assign": "^4.1.0", + "promise": "^7.1.1", + "setimmediate": "^1.0.5", + "ua-parser-js": "^0.7.18" + } + }, + "promise": { + "version": "7.3.1", + "resolved": "https://registry.npm.taobao.org/promise/download/promise-7.3.1.tgz", + "integrity": "sha1-BktyYCsY+Q8pGSuLG8QY/9Hr078=", + "dev": true, + "requires": { + "asap": "~2.0.3" + } + } + } + }, "flv.js": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/flv.js/-/flv.js-1.5.0.tgz", @@ -10330,6 +10430,12 @@ "resolved": "https://registry.npmjs.org/lodash.cond/-/lodash.cond-4.5.2.tgz", "integrity": "sha1-9HGh2khr5g9quVXRcRVSPdHSVdU=" }, + "lodash.curry": { + "version": "4.1.1", + "resolved": "https://registry.npm.taobao.org/lodash.curry/download/lodash.curry-4.1.1.tgz", + "integrity": "sha1-JI42By7ekGUB11lmIAqG2riyMXA=", + "dev": true + }, "lodash.debounce": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", @@ -10340,6 +10446,12 @@ "resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-4.2.0.tgz", "integrity": "sha1-0JF4cW/+pN3p5ft7N/bwgCJ0WAw=" }, + "lodash.flow": { + "version": "3.5.0", + "resolved": "https://registry.npm.taobao.org/lodash.flow/download/lodash.flow-3.5.0.tgz", + "integrity": "sha1-h79AKSuM+D5OjOGjrkIJ4gBxZ1o=", + "dev": true + }, "lodash.isequal": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", @@ -13970,6 +14082,12 @@ "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" }, + "pure-color": { + "version": "1.3.0", + "resolved": "https://registry.npm.taobao.org/pure-color/download/pure-color-1.3.0.tgz", + "integrity": "sha1-H+Bk+wrIUfDeYTIKi/eWg2Qi8z4=", + "dev": true + }, "purgecss": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/purgecss/-/purgecss-2.1.2.tgz", @@ -14741,6 +14859,18 @@ "prop-types": "^15.6.2" } }, + "react-base16-styling": { + "version": "0.6.0", + "resolved": "https://registry.npm.taobao.org/react-base16-styling/download/react-base16-styling-0.6.0.tgz", + "integrity": "sha1-7yFW1mz0E5aVyKFniGy2nqZgeSw=", + "dev": true, + "requires": { + "base16": "^1.0.0", + "lodash.curry": "^4.0.1", + "lodash.flow": "^3.3.0", + "pure-color": "^1.2.0" + } + }, "react-beautiful-dnd": { "version": "10.1.1", "resolved": "https://registry.npmjs.org/react-beautiful-dnd/-/react-beautiful-dnd-10.1.1.tgz", @@ -15106,6 +15236,18 @@ "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" }, + "react-json-view": { + "version": "1.21.3", + "resolved": "https://registry.npm.taobao.org/react-json-view/download/react-json-view-1.21.3.tgz", + "integrity": "sha1-8YQgnujxvzdPsMQbCBPP9UVJxHU=", + "dev": true, + "requires": { + "flux": "^4.0.1", + "react-base16-styling": "^0.6.0", + "react-lifecycles-compat": "^3.0.4", + "react-textarea-autosize": "^8.3.2" + } + }, "react-jss": { "version": "8.6.1", "resolved": "https://registry.npmjs.org/react-jss/-/react-jss-8.6.1.tgz", @@ -15294,6 +15436,34 @@ "prop-types": "^15.5.4" } }, + "react-textarea-autosize": { + "version": "8.3.3", + "resolved": "https://registry.nlark.com/react-textarea-autosize/download/react-textarea-autosize-8.3.3.tgz?cache=0&sync_timestamp=1622628433420&other_urls=https%3A%2F%2Fregistry.nlark.com%2Freact-textarea-autosize%2Fdownload%2Freact-textarea-autosize-8.3.3.tgz", + "integrity": "sha1-9wkTlFNp2kU/1VTBaPa6rNH6BNg=", + "dev": true, + "requires": { + "@babel/runtime": "^7.10.2", + "use-composed-ref": "^1.0.0", + "use-latest": "^1.0.0" + }, + "dependencies": { + "@babel/runtime": { + "version": "7.14.8", + "resolved": "https://registry.nlark.com/@babel/runtime/download/@babel/runtime-7.14.8.tgz", + "integrity": "sha1-cRmlb0IQGIUmlCkLn5FICXORtEY=", + "dev": true, + "requires": { + "regenerator-runtime": "^0.13.4" + } + }, + "regenerator-runtime": { + "version": "0.13.9", + "resolved": "https://registry.nlark.com/regenerator-runtime/download/regenerator-runtime-0.13.9.tgz?cache=0&sync_timestamp=1626993001371&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fregenerator-runtime%2Fdownload%2Fregenerator-runtime-0.13.9.tgz", + "integrity": "sha1-iSV0Kpj/2QgUmI11Zq0wyjsmO1I=", + "dev": true + } + } + }, "react-transition-group": { "version": "2.9.0", "resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-2.9.0.tgz", @@ -18389,6 +18559,12 @@ "integrity": "sha512-c3zayb8/kWWpycWYg87P71E1S1ZL6b6IJxfb5fvsUgsf0S2MVGaDhDXXjDMpdCpfWXqptc+4mXwmiy1ypXqRAA==", "dev": true }, + "ts-essentials": { + "version": "2.0.12", + "resolved": "https://registry.nlark.com/ts-essentials/download/ts-essentials-2.0.12.tgz", + "integrity": "sha1-yTA/PXT3X6dSjD1JuA4ImrCdh0U=", + "dev": true + }, "tslib": { "version": "1.11.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.11.1.tgz", @@ -18898,6 +19074,30 @@ "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==" }, + "use-composed-ref": { + "version": "1.1.0", + "resolved": "https://registry.npm.taobao.org/use-composed-ref/download/use-composed-ref-1.1.0.tgz", + "integrity": "sha1-kiDk6UqXt7AtfSfq6rCzcDRDi7w=", + "dev": true, + "requires": { + "ts-essentials": "^2.0.3" + } + }, + "use-isomorphic-layout-effect": { + "version": "1.1.1", + "resolved": "https://registry.npm.taobao.org/use-isomorphic-layout-effect/download/use-isomorphic-layout-effect-1.1.1.tgz", + "integrity": "sha1-e7ZYkXDNKYehUgQvkIT57/t1wiU=", + "dev": true + }, + "use-latest": { + "version": "1.2.0", + "resolved": "https://registry.npm.taobao.org/use-latest/download/use-latest-1.2.0.tgz", + "integrity": "sha1-pE9lcrgojgly7EEb3QhAraNm8jI=", + "dev": true, + "requires": { + "use-isomorphic-layout-effect": "^1.0.0" + } + }, "user-home": { "version": "1.1.1", "resolved": "https://registry.npm.taobao.org/user-home/download/user-home-1.1.1.tgz", diff --git a/package.json b/package.json index 20880eaeb..a78351cba 100644 --- a/package.json +++ b/package.json @@ -204,6 +204,7 @@ "node-sass": "^4.12.0", "optimize-css-assets-webpack-plugin": "^5.0.3", "purgecss": "^2.1.2", + "react-json-view": "^1.21.3", "reqwest": "^2.0.5", "resize-observer-polyfill": "^1.5.1", "terser-webpack-plugin": "^2.3.5", diff --git a/public/css/edu-purge.css b/public/css/edu-purge.css index 1dc17448b..f721824be 100644 --- a/public/css/edu-purge.css +++ b/public/css/edu-purge.css @@ -2424,10 +2424,16 @@ input::-ms-clear { .color-grey-c { color: #ccc !important; } - +a.hoverLine:hover{ + text-decoration: underline; +} .color-grey-cd { color: #cdcdcd !important; } +.color-grey-d { + color: #ddd; +} + .color-grey-9 { color: #999999 !important; diff --git a/public/css/iconfont.css b/public/css/iconfont.css index fbd30d52c..caf053b94 100644 --- a/public/css/iconfont.css +++ b/public/css/iconfont.css @@ -1,8 +1,8 @@ @font-face { font-family: "iconfont"; /* Project id 2340181 */ - src: url('iconfont.woff2?t=1626838578464') format('woff2'), - url('iconfont.woff?t=1626838578464') format('woff'), - url('iconfont.ttf?t=1626838578464') format('truetype'); + src: url('iconfont.woff2?t=1627378753360') format('woff2'), + url('iconfont.woff?t=1627378753360') format('woff'), + url('iconfont.ttf?t=1627378753360') format('truetype'); } .iconfont { @@ -13,6 +13,182 @@ -moz-osx-font-smoothing: grayscale; } +.icon-duoxuanxuanzhong:before { + content: "\e88f"; +} + +.icon-cuowuicon:before { + content: "\e890"; +} + +.icon-daochu_xuanfu1:before { + content: "\e891"; +} + +.icon-chenggongicon:before { + content: "\e892"; +} + +.icon-weixuanzhongxiangyingicon:before { + content: "\e893"; +} + +.icon-bitianicon:before { + content: "\e895"; +} + +.icon-weixuanzhongxiangmubiaoqianicon:before { + content: "\e897"; +} + +.icon-liebiaoicon:before { + content: "\e898"; +} + +.icon-xialaanniu_icon:before { + content: "\e89a"; +} + +.icon-weixuanzhongqingqiuicon:before { + content: "\e89b"; +} + +.icon-xuanzhong3:before { + content: "\e89e"; +} + +.icon-xuanzechenggongicon:before { + content: "\e89f"; +} + +.icon-xiezuozheguanliicon:before { + content: "\e8a1"; +} + +.icon-xuanzhongxiangyingicon:before { + content: "\e8a2"; +} + +.icon-xuanzhongfenzhiicon:before { + content: "\e8a3"; +} + +.icon-bg:before { + content: "\e8a4"; +} + +.icon-xuanzhongjibenshezhiicon:before { + content: "\e8a5"; +} + +.icon-xuanzhongxiangmubiaoqianicon:before { + content: "\e8aa"; +} + +.icon-a-xuanzhongwebhookicon:before { + content: "\e8af"; +} + +.icon-xinzengmulu_xuantingicon:before { + content: "\e884"; +} + +.icon-xinzengyemian_morenicon:before { + content: "\e885"; +} + +.icon-zhankai_morenicon:before { + content: "\e889"; +} + +.icon-shanchu_tc_icon:before { + content: "\e88c"; +} + +.icon-wiki_icon:before { + content: "\e88d"; +} + +.icon-xinzengyemian_shubiaodianjiicon:before { + content: "\e88e"; +} + +.icon-daorumoban_icon:before { + content: "\e86f"; +} + +.icon-daochu_xuanfu:before { + content: "\e870"; +} + +.icon-fuceng:before { + content: "\e871"; +} + +.icon-cuowu:before { + content: "\e872"; +} + +.icon-chenggong1:before { + content: "\e873"; +} + +.icon-gengduo_icon:before { + content: "\e874"; +} + +.icon-fucengguanbi_icon:before { + content: "\e875"; +} + +.icon-fuzhi_icon:before { + content: "\e876"; +} + +.icon-shanchuicon:before { + content: "\e877"; +} + +.icon-a-lajitong_icon3x:before { + content: "\e878"; +} + +.icon-shouqi_morenicon:before { + content: "\e879"; +} + +.icon-huanying_icon:before { + content: "\e87a"; +} + +.icon-sousuo_shanchuicon:before { + content: "\e87b"; +} + +.icon-sousuo_icon:before { + content: "\e87d"; +} + +.icon-wendangyulan_icon:before { + content: "\e87e"; +} + +.icon-wenjianjia_icon:before { + content: "\e87f"; +} + +.icon-xialaanniu:before { + content: "\e880"; +} + +.icon-xinzengmulu_morenicon:before { + content: "\e882"; +} + +.icon-xinzengmulu_shubiaodianjiicon:before { + content: "\e883"; +} + .icon-erciqueren_icon:before { content: "\e867"; } diff --git a/public/css/iconfont.js b/public/css/iconfont.js index 77ba176ff..ce56b8293 100644 --- a/public/css/iconfont.js +++ b/public/css/iconfont.js @@ -1 +1 @@ -!function(c){var l,a,h,i,o,z,t='',p=(p=document.getElementsByTagName("script"))[p.length-1].getAttribute("data-injectcss");if(p&&!c.__iconfont__svg__cssinject__){c.__iconfont__svg__cssinject__=!0;try{document.write("")}catch(c){console&&console.log(c)}}function v(){o||(o=!0,h())}l=function(){var c,l,a;(a=document.createElement("div")).innerHTML=t,t=null,(l=a.getElementsByTagName("svg")[0])&&(l.setAttribute("aria-hidden","true"),l.style.position="absolute",l.style.width=0,l.style.height=0,l.style.overflow="hidden",c=l,(a=document.body).firstChild?(l=a.firstChild).parentNode.insertBefore(c,l):a.appendChild(c))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(l,0):(a=function(){document.removeEventListener("DOMContentLoaded",a,!1),l()},document.addEventListener("DOMContentLoaded",a,!1)):document.attachEvent&&(h=l,i=c.document,o=!1,(z=function(){try{i.documentElement.doScroll("left")}catch(c){return void setTimeout(z,50)}v()})(),i.onreadystatechange=function(){"complete"==i.readyState&&(i.onreadystatechange=null,v())})}(window); \ No newline at end of file +!function(c){var l,a,h,i,o,z,t='',p=(p=document.getElementsByTagName("script"))[p.length-1].getAttribute("data-injectcss");if(p&&!c.__iconfont__svg__cssinject__){c.__iconfont__svg__cssinject__=!0;try{document.write("")}catch(c){console&&console.log(c)}}function v(){o||(o=!0,h())}l=function(){var c,l,a;(a=document.createElement("div")).innerHTML=t,t=null,(l=a.getElementsByTagName("svg")[0])&&(l.setAttribute("aria-hidden","true"),l.style.position="absolute",l.style.width=0,l.style.height=0,l.style.overflow="hidden",c=l,(a=document.body).firstChild?(l=a.firstChild).parentNode.insertBefore(c,l):a.appendChild(c))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(l,0):(a=function(){document.removeEventListener("DOMContentLoaded",a,!1),l()},document.addEventListener("DOMContentLoaded",a,!1)):document.attachEvent&&(h=l,i=c.document,o=!1,(z=function(){try{i.documentElement.doScroll("left")}catch(c){return void setTimeout(z,50)}v()})(),i.onreadystatechange=function(){"complete"==i.readyState&&(i.onreadystatechange=null,v())})}(window); \ No newline at end of file diff --git a/public/css/iconfont.json b/public/css/iconfont.json index 44d85cac9..1ccafde67 100644 --- a/public/css/iconfont.json +++ b/public/css/iconfont.json @@ -5,6 +5,314 @@ "css_prefix_text": "icon-", "description": "", "glyphs": [ + { + "icon_id": "23144143", + "name": "多选选中", + "font_class": "duoxuanxuanzhong", + "unicode": "e88f", + "unicode_decimal": 59535 + }, + { + "icon_id": "23144144", + "name": "错误icon", + "font_class": "cuowuicon", + "unicode": "e890", + "unicode_decimal": 59536 + }, + { + "icon_id": "23144145", + "name": "导出_悬浮", + "font_class": "daochu_xuanfu1", + "unicode": "e891", + "unicode_decimal": 59537 + }, + { + "icon_id": "23144146", + "name": "成功icon", + "font_class": "chenggongicon", + "unicode": "e892", + "unicode_decimal": 59538 + }, + { + "icon_id": "23144147", + "name": "未选中响应icon", + "font_class": "weixuanzhongxiangyingicon", + "unicode": "e893", + "unicode_decimal": 59539 + }, + { + "icon_id": "23144149", + "name": "必填icon", + "font_class": "bitianicon", + "unicode": "e895", + "unicode_decimal": 59541 + }, + { + "icon_id": "23144151", + "name": "未选中项目标签icon", + "font_class": "weixuanzhongxiangmubiaoqianicon", + "unicode": "e897", + "unicode_decimal": 59543 + }, + { + "icon_id": "23144152", + "name": "列表icon", + "font_class": "liebiaoicon", + "unicode": "e898", + "unicode_decimal": 59544 + }, + { + "icon_id": "23144154", + "name": "下拉按钮_icon", + "font_class": "xialaanniu_icon", + "unicode": "e89a", + "unicode_decimal": 59546 + }, + { + "icon_id": "23144155", + "name": "未选中请求icon", + "font_class": "weixuanzhongqingqiuicon", + "unicode": "e89b", + "unicode_decimal": 59547 + }, + { + "icon_id": "23144156", + "name": "选中", + "font_class": "xuanzhong3", + "unicode": "e89e", + "unicode_decimal": 59550 + }, + { + "icon_id": "23144157", + "name": "选择成功icon", + "font_class": "xuanzechenggongicon", + "unicode": "e89f", + "unicode_decimal": 59551 + }, + { + "icon_id": "23144158", + "name": "协作者管理icon", + "font_class": "xiezuozheguanliicon", + "unicode": "e8a1", + "unicode_decimal": 59553 + }, + { + "icon_id": "23144159", + "name": "选中响应icon", + "font_class": "xuanzhongxiangyingicon", + "unicode": "e8a2", + "unicode_decimal": 59554 + }, + { + "icon_id": "23144160", + "name": "选中分支icon", + "font_class": "xuanzhongfenzhiicon", + "unicode": "e8a3", + "unicode_decimal": 59555 + }, + { + "icon_id": "23144161", + "name": "bg", + "font_class": "bg", + "unicode": "e8a4", + "unicode_decimal": 59556 + }, + { + "icon_id": "23144162", + "name": "选中基本设置icon", + "font_class": "xuanzhongjibenshezhiicon", + "unicode": "e8a5", + "unicode_decimal": 59557 + }, + { + "icon_id": "23144165", + "name": "选中项目标签icon", + "font_class": "xuanzhongxiangmubiaoqianicon", + "unicode": "e8aa", + "unicode_decimal": 59562 + }, + { + "icon_id": "23144167", + "name": "选中webhook icon", + "font_class": "a-xuanzhongwebhookicon", + "unicode": "e8af", + "unicode_decimal": 59567 + }, + { + "icon_id": "23046282", + "name": "新增目录_悬停icon", + "font_class": "xinzengmulu_xuantingicon", + "unicode": "e884", + "unicode_decimal": 59524 + }, + { + "icon_id": "23046283", + "name": "新增页面_默认icon", + "font_class": "xinzengyemian_morenicon", + "unicode": "e885", + "unicode_decimal": 59525 + }, + { + "icon_id": "23046287", + "name": "展开_默认icon", + "font_class": "zhankai_morenicon", + "unicode": "e889", + "unicode_decimal": 59529 + }, + { + "icon_id": "23046290", + "name": "shanchu_tc_icon", + "font_class": "shanchu_tc_icon", + "unicode": "e88c", + "unicode_decimal": 59532 + }, + { + "icon_id": "23046293", + "name": "wiki_icon", + "font_class": "wiki_icon", + "unicode": "e88d", + "unicode_decimal": 59533 + }, + { + "icon_id": "23046311", + "name": "新增页面_鼠标点击icon", + "font_class": "xinzengyemian_shubiaodianjiicon", + "unicode": "e88e", + "unicode_decimal": 59534 + }, + { + "icon_id": "23046244", + "name": "导入模版_icon", + "font_class": "daorumoban_icon", + "unicode": "e86f", + "unicode_decimal": 59503 + }, + { + "icon_id": "23046247", + "name": "导出_悬浮", + "font_class": "daochu_xuanfu", + "unicode": "e870", + "unicode_decimal": 59504 + }, + { + "icon_id": "23046249", + "name": "复层", + "font_class": "fuceng", + "unicode": "e871", + "unicode_decimal": 59505 + }, + { + "icon_id": "23046252", + "name": "错误", + "font_class": "cuowu", + "unicode": "e872", + "unicode_decimal": 59506 + }, + { + "icon_id": "23046254", + "name": "成功", + "font_class": "chenggong1", + "unicode": "e873", + "unicode_decimal": 59507 + }, + { + "icon_id": "23046255", + "name": "更多_icon", + "font_class": "gengduo_icon", + "unicode": "e874", + "unicode_decimal": 59508 + }, + { + "icon_id": "23046258", + "name": "复层关闭_icon", + "font_class": "fucengguanbi_icon", + "unicode": "e875", + "unicode_decimal": 59509 + }, + { + "icon_id": "23046262", + "name": "复制_icon", + "font_class": "fuzhi_icon", + "unicode": "e876", + "unicode_decimal": 59510 + }, + { + "icon_id": "23046268", + "name": "删除icon", + "font_class": "shanchuicon", + "unicode": "e877", + "unicode_decimal": 59511 + }, + { + "icon_id": "23046269", + "name": "垃圾桶_icon@3x", + "font_class": "a-lajitong_icon3x", + "unicode": "e878", + "unicode_decimal": 59512 + }, + { + "icon_id": "23046270", + "name": "收起_默认icon", + "font_class": "shouqi_morenicon", + "unicode": "e879", + "unicode_decimal": 59513 + }, + { + "icon_id": "23046271", + "name": "欢迎_icon", + "font_class": "huanying_icon", + "unicode": "e87a", + "unicode_decimal": 59514 + }, + { + "icon_id": "23046273", + "name": "搜索_删除icon", + "font_class": "sousuo_shanchuicon", + "unicode": "e87b", + "unicode_decimal": 59515 + }, + { + "icon_id": "23046275", + "name": "搜索_icon", + "font_class": "sousuo_icon", + "unicode": "e87d", + "unicode_decimal": 59517 + }, + { + "icon_id": "23046276", + "name": "文档预览_icon", + "font_class": "wendangyulan_icon", + "unicode": "e87e", + "unicode_decimal": 59518 + }, + { + "icon_id": "23046277", + "name": "文件夹_icon", + "font_class": "wenjianjia_icon", + "unicode": "e87f", + "unicode_decimal": 59519 + }, + { + "icon_id": "23046278", + "name": "下拉按钮", + "font_class": "xialaanniu", + "unicode": "e880", + "unicode_decimal": 59520 + }, + { + "icon_id": "23046280", + "name": "新增目录_默认icon", + "font_class": "xinzengmulu_morenicon", + "unicode": "e882", + "unicode_decimal": 59522 + }, + { + "icon_id": "23046281", + "name": "新增目录_鼠标点击icon", + "font_class": "xinzengmulu_shubiaodianjiicon", + "unicode": "e883", + "unicode_decimal": 59523 + }, { "icon_id": "22906287", "name": "二次确认_icon", diff --git a/public/css/iconfont.ttf b/public/css/iconfont.ttf index 662bd6630..fd977e5ac 100644 Binary files a/public/css/iconfont.ttf and b/public/css/iconfont.ttf differ diff --git a/public/css/iconfont.woff b/public/css/iconfont.woff index 6b554c8a3..ee0555e38 100644 Binary files a/public/css/iconfont.woff and b/public/css/iconfont.woff differ diff --git a/public/css/iconfont.woff2 b/public/css/iconfont.woff2 index 171927971..35a1ece2f 100644 Binary files a/public/css/iconfont.woff2 and b/public/css/iconfont.woff2 differ diff --git a/src/forge/Component/DeleteModal/Index.jsx b/src/forge/Component/DeleteModal/Index.jsx new file mode 100644 index 000000000..7e631dac6 --- /dev/null +++ b/src/forge/Component/DeleteModal/Index.jsx @@ -0,0 +1,35 @@ +import React from 'react'; +import { AlignCenter } from '../layout'; +import { Modal , Button } from 'antd'; +import './Index.scss'; + +function DeleteBox({ + visible , + onCancel , + onSuccess , + title , + subTitle, + content +}) { + return( + + + + + } + > +
+ {content} +

{subTitle}

+
+
+ ) +} +export default DeleteBox; \ No newline at end of file diff --git a/src/forge/Component/DeleteModal/Index.scss b/src/forge/Component/DeleteModal/Index.scss new file mode 100644 index 000000000..7df79ebf5 --- /dev/null +++ b/src/forge/Component/DeleteModal/Index.scss @@ -0,0 +1,45 @@ +.deleteBox{ + .ant-modal-header{ + background-color: #f8f8f8; + border-bottom: none; + .ant-modal-title{ + text-align: left; + font-size: 20px; + } + } + .ant-modal-body{ + padding:30px 50px; + p{ + font-size: 16px; + line-height: 26px; + color:#666; + word-break: break-all; + } + .desc{ + .descMain{ + align-items: center; + justify-content: center; + font-size: 20px; + margin-bottom: 10px; + i{ + font-size: 38px!important; + color:#DF0002 + } + } + } + } + .ant-modal-footer{ + border-top: none; + text-align: center; + padding-bottom: 40px; + button{ + width: 120px; + margin:0px 20px; + &.ant-btn-danger{ + background-color: #fff; + color: #DF0002; + border-color: #D0D0D0; + } + } + } +} \ No newline at end of file diff --git a/src/forge/Component/Monaco.jsx b/src/forge/Component/Monaco.jsx new file mode 100644 index 000000000..aa70d8031 --- /dev/null +++ b/src/forge/Component/Monaco.jsx @@ -0,0 +1,62 @@ +import React, {useEffect, useRef, useState} from 'react'; +import * as monaco from 'monaco-editor/esm/vs/editor/editor.api.js'; +import './Component.scss'; + +function Monaco(props) { + const { + style = { // dom节点样式 + height: '400px', + }, + value = '', // 代码文本 + onChange = () => { // 改变的事件 + }, + fontSize = 14, // 代码字体大小 + monacoOptions = { + scrollBeyondLastLine: false, + lineNumbers: "off", + wordWrap: true, + overviewRulerBorder: true, + lineHeight: 24, + readOnly:true + }, // monaco 自定义属性 + language = 'html', // 语言 支持 js ts sql css json html等 + } = props; + const editOrRef = useRef(); + const ThisEditor = useRef(); + useEffect(() => { + ThisEditor.current = monaco.editor.create(editOrRef.current, { + value: value || '', + language, + theme: "vs-grey", + fontSize: fontSize + 'px', + minimap: { // 关闭代码缩略图 + enabled: false, + }, + ...monacoOptions, + }); + + ThisEditor.current.onDidChangeModelContent((e) => { + let newValue = ThisEditor.current.getValue(); + onChange(newValue); + }); + return () => { + ThisEditor.current.dispose(); + ThisEditor.current = undefined; // 清除编辑器对象 + } + }, []); + useEffect(() => { + if (ThisEditor.current) { + ThisEditor.current.updateOptions({ + fontSize: fontSize + 'px', + }) + } + }, [fontSize]); + + return ( +
+ +
+ ); +} + +export default Monaco; \ No newline at end of file diff --git a/src/forge/SecuritySetting/sub/SSH.jsx b/src/forge/SecuritySetting/sub/SSH.jsx index b46fb262e..bc004e119 100644 --- a/src/forge/SecuritySetting/sub/SSH.jsx +++ b/src/forge/SecuritySetting/sub/SSH.jsx @@ -40,7 +40,11 @@ function SSH(props) { if(result && result.data){ props.showNotification("密钥删除成功!"); setVisible(false); - Init(); + if(page>1 && (list && list.length===1)){ + setPage(page-1); + }else{ + Init(); + } } }).catch(error=>{}) } diff --git a/src/forge/Settings/Index.js b/src/forge/Settings/Index.js index 17ae87614..c8fd2f1ef 100644 --- a/src/forge/Settings/Index.js +++ b/src/forge/Settings/Index.js @@ -20,6 +20,14 @@ const Setting = Loadable({ loader: () => import("./Setting"), loading: Loading, }); +const WebhookNew = Loadable({ + loader: () => import("./Webhooks/New"), + loading: Loading, +}); +const Webhook = Loadable({ + loader: () => import("./Webhooks/Index"), + loading: Loading, +}); const Collaborator = Loadable({ loader: () => import("./Collaborator"), loading: Loading, @@ -65,6 +73,18 @@ class Index extends Component {

+
  • -1 ? "active" : "" + } + > +

    + + + Webhooks + +

    +
  • -1 ? "active" : "" @@ -103,8 +123,27 @@ class Index extends Component { - + + {/* webhooks */} + ( + + )} + > + ( + + )} + > + ( + + )} + > {/* 协作者 */} { + if(owner && projectsId){ + getData(); + } + },[owner,projectsId,page]) + + function getData() { + const url = `/${owner}/${projectsId}/webhooks.json`; + axios.get(url,{ + params:{page,limit} + }).then(result=>{ + if(result && result.data){ + setData(result.data.webhooks); + setTotal(result.data.total_count); + } + }).catch(error=>{}) + } + + function deleteFunc(id,url) { + setDeleteId(id); + setUrl(url); + setVisible(true); + } + + function onSuccess() { + if(deleteId){ + const url = `/${owner}/${projectsId}/webhooks/${deleteId}.json`; + axios.delete(url).then(result=>{ + if(result){ + props.showNotification("webhook删除成功!"); + if(page>1 && data.length === 1){ + setPage(page-1); + }else{ + getData(); + } + setVisible(false); + } + }).catch(error=>{}) + } + } + + function addFunc() { + if(total >= 20){ + return props.showNotification("webhooks数量已到上限!请删除暂不使用的webhooks以进行添加操作"); + } + props.history.push(`/projects/${owner}/${projectsId}/setting/webhooks/new`) + } + + return( +
    + setVisible(false)} + onSuccess={onSuccess} + title="删除Webhook" + content="您确定要删除此Webhook吗?" + subTitle={`删除后未来事件将不会推送至此Webhook地址:${url}`} + /> + + + Webhooks + + + +
    +

    每当特定事件(如push代码,合并请求被编辑)发生时,我们将通过webhook给您提供的远程URL发送post请求。您可以在我们的webhooks指南中了解更多信息

    + { + data && data.length> 0 && + + {data.map((i,k)=>{ + return( + + + {i.url} + + + + + + ) + })} + + } + { + total > limit && +
    + {setPage(e)}} pageSize={limit}/> +
    + } +
    +
    + ) +} +export default Index; \ No newline at end of file diff --git a/src/forge/Settings/Webhooks/Index.scss b/src/forge/Settings/Webhooks/Index.scss new file mode 100644 index 000000000..6c166a730 --- /dev/null +++ b/src/forge/Settings/Webhooks/Index.scss @@ -0,0 +1,171 @@ +.hookpanel{ + &>p{ + padding:20px 25px 0px 20px; + } + .ant-list{ + .ant-list-item{ + padding:15px 20px; + &:last-child{ + border-bottom: 1px solid #e8e8e8; + } + .webName{ + flex:1; + margin-right: 15px; + word-break: break-all; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + } + } + } +} +.newPanel{ + .ant-form .ant-form-item-label label{ + font-size: 16px; + } + .has-success .ant-form-explain{ + font-size: 12px; + color: #999; + line-height: 20px; + margin-top: 5px; + word-break: break-all; + } + .ant-form{ + .ant-row{ + padding:0px 194px 0px 20px; + &.topLine{ + border-top: 1px solid #EEEEEE; + padding-top:20px; + margin-top: 25px; + } + &.bottomLine{ + border-bottom: 1px solid #EEEEEE; + padding-bottom:20px; + margin-bottom: 25px; + .ant-checkbox + span{ + font-size: 16px; + } + } + } + } + .eventCb{ + padding:0px 194px 0px 45px; + .ant-checkbox-group{ + width: 100%; + } + .colSpan{ + display: flex; + flex-wrap: wrap; + &>span{ + width: 50%; + margin:0px; + display: block; + &>span{ + display: block; + padding-left: 24px; + margin-bottom: 20px; + font-size: 12px; + } + } + } + } + .ant-form-item-children{ + display: block; + } + .ant-checkbox + span{ + color: #333; + &>span{ + color: #333333; + height: 20px; + line-height: 20px; + padding-left: 24px; + font-size: 12px; + display: block; + } + } +} +.deschead{ + background: #FAFCFF; + border-radius: 4px 4px 0px 0px; + border: 1px solid rgba(42, 97, 255, 0.23); + height: 50px; + padding:0px 20px; + margin-top: 20px; + display: flex; + align-items: center; + justify-content: space-between; +} +.deschead.mg{ + margin:20px!important; + padding:0px 12px; +} +.historyColl{ + .ant-collapse-header{ + background-color: #fff; + } + .panelHeader{ + display: flex; + span{ + width: 20%; + color: #333; + font-weight: 400; + } + .time{ + text-align: right; + } + .name{ + flex:1; + } + } + .ant-collapse-content-box{ + background-color: #fff; + } +} +.contentMenu{ + li{ + font-weight: 500; + } + margin-left:14px; +} +.contentPanel{ + .retitle{ + font-size: 16px; + font-weight: 600; + color: #333333; + margin:20px 0px 10px!important; + } + .con{ + background: #EEEEEE; + border-radius: 4px; + padding:15px; + max-height: 400px; + overflow: auto; + p{ + font-size: 13px; + color:#333; + line-height: 28px; + &>span:first-child{ + font-weight: 500; + } + } + } + .conEditor{ + .overflow-guard{ + border-radius: 4px; + } + .margin-view-overlays{ + background-color: #eee; + &>div{ + background-color: #eee; + } + } + .lines-content{ + background-color: #eee; + } + .view-lines{ + &>div{ + background-color: #eee; + } + } + } +} \ No newline at end of file diff --git a/src/forge/Settings/Webhooks/New.jsx b/src/forge/Settings/Webhooks/New.jsx new file mode 100644 index 000000000..7a2b0b312 --- /dev/null +++ b/src/forge/Settings/Webhooks/New.jsx @@ -0,0 +1,336 @@ +import React , { forwardRef, useEffect, useState } from 'react'; +import { Form , Input , Button , Select , Radio , Checkbox } from 'antd'; +import { Banner } from '../../Component/layout'; +import { Link } from 'react-router-dom'; +import axios from 'axios'; +import PushHistory from './sub/PushHistory'; +import DeleteBox from '../../Component/DeleteModal/Index'; +import './Index.scss'; + +// ,"issue_assign","issue_label","issue_milestone","issue_comment","issue_only","fork", +//"pull_request_milestone","pull_request_sync","pull_request_comment","repository","pull_request_label" +const eventArray = [ + "create","delete","push","pull_request_assign","pull_request_review","pull_request_only" +] +function New({ form , match , showNotification , history }) { + const [ httpValue , setHttpValue ] = useState("POST"); + const [ posthttpValue , setPostHttpValue ] = useState("json"); + const [ condition , setCondition ] = useState("push"); + const [ event , setEvent ] = useState(["push"]); + const [ visible , setVisible ] = useState(false); + const [ data , setData ] = useState(undefined); + const [ eventFlag , setEventFlag ] = useState(false); + + const { getFieldDecorator, validateFields , setFieldsValue } = form; + const { id , owner , projectsId } = match.params; + + function compareArray(params) { + if(params && params.length > 0){ + if(params.length === 1 && params[0] === "push"){ + setEvent(['push']); + return "push"; + }else if(params.length === eventArray.length){ + setEvent(eventArray); + return "all"; + }else{ + setEvent([]); + return "forevent"; + } + } + } + + useEffect(()=>{ + if(id){ + Init(); + }else{ + let e = compareArray(event); + setCondition(e); + setFieldsValue({ + url:"", + secret:"", + http_method:httpValue, + content_type:posthttpValue, + eventCondition:condition, + event:event, + branch_filter:"*", + active:true + }) + } + },[id]) + + function Init() { + const url = `/${owner}/${projectsId}/webhooks/${id}/edit.json`; + axios.get(url).then(result=>{ + if(result){ + let e = compareArray(result.data.events); + setFieldsValue({ + ...result.data, + eventCondition:e, + active:result.data.is_active + }) + setData(result.data); + setHttpValue(result.data.http_method); + setCondition(e); + setEvent(result.data.events); + } + }).catch(error=>{}) + } + + function changeHTTP(value) { + setHttpValue(value); + } + + function changeCondition(e) { + setCondition(e.target.value); + if(e.target.value === "push"){ + setEvent(["push"]) + }else if(e.target.value === "all"){ + setEvent(eventArray) + }else{ + setEvent([]) + } + } + + function submit() { + validateFields((error,values)=>{ + if(!error){ + if(values.eventCondition === "forevent" && event.length === 0){ + setEventFlag(true); + return; + } + let e = values.eventCondition === "push" ? ['push'] : values.eventCondition === "all" ? eventArray : event; + + if(id){ + // 编辑 + const url = `/${owner}/${projectsId}/webhooks/${id}.json`; + axios.patch(url,{ + webhook:{ + ...values, + events:e + } + }).then(result=>{ + if(result){ + showNotification("webhook更新成功!"); + history.push(`/projects/${owner}/${projectsId}/setting/webhooks`); + } + }).catch(error=>{}) + }else{ + // 保存 + const url = `/${owner}/${projectsId}/webhooks.json`; + axios.post(url,{ + webhook:{ + ...values, + events:e + } + }).then(result=>{ + if(result && result.data && result.data.id){ + showNotification("webhook新建成功!"); + history.push(`/projects/${owner}/${projectsId}/setting/webhooks`); + } + }).catch(error=>{}) + } + + } + }) + } + + function checkAddr(rule, value, callback) { + let reg = /(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/; + if(!value){ + callback(); + } + if (!reg.test(value)){ + callback("请输入有效的URL"); + } + callback(); + } + + function deleteFunc() { + if(id){ + setVisible(true); + } + } + + function onSuccess() { + if(id){ + const url = `/${owner}/${projectsId}/webhooks/${id}.json`; + axios.delete(url).then(result=>{ + if(result){ + showNotification("webhook删除成功!"); + history.push(`/projects/${owner}/${projectsId}/setting/webhooks`); + } + }).catch(error=>{}) + } + } + + const radioStyle = { + display: 'block', + height: '30px', + lineHeight: '30px', + }; + + return( +
    + setVisible(false)} + onSuccess={onSuccess} + title="删除Webhook" + content="您确定要删除此Webhook吗?" + subTitle={`删除后未来事件将不会推送至此Webhook地址:${data && data.url}`} + /> + + Webhooks + + {id ? "更新" : "添加"}Webhook + +
    +

    当webhook被触发时,我们将向以下URL发送通知,包括已选择事件的详细信息。更多信息可查阅webhooks指南

    +
    + + {getFieldDecorator("url",{ + rules:[ + {required:true,message:"请输入目标URL"}, + { + validator:checkAddr + } + ] + })( + + )} + + + {getFieldDecorator("secret",{ + rules:[] + })( + + )} + + + {getFieldDecorator("http_method",{ + rules:[] + })( + + )} + + + {getFieldDecorator("content_type",{ + rules:[] + })( + + )} + + + {getFieldDecorator("eventCondition",{ + rules:[] + })( + + 只是push事件 + 所有事件 + 自定义事件 + + )} + +
    + {setEvent(e)}}> +

    代码库事件

    +
    + + 推送 + git推送到存储库 + + {/* + 代码库 + 创建或删除代码库 + */} + + 创建 + 创建分支或标签 + + + 删除 + 删除分支或标签 + +
    +

    合并请求事件

    +
    + + 合并请求 + 合并请求被打开、被关闭、被重新打开或被编辑 + + + 合并请求分配 + 合并请求被分配或取消分配 + + {/* + 合并请求收入里程碑 + 合并请求被记录或取消记录于里程碑中 + */} + {/* + 合并请求被评论 + 合并请求评论被创建、编辑或删除 + */} + {/* + 合并请求标签 + 合并请求的标签被更新或清除 + */} + + 合并请求审查 + 合并请求被批准、拒绝或提出审查意见,审查人员的修改,审查线程已解决或未解决 + + {/* + 合并请求被同步 + 合并请求被同步 + */} +
    +
    + { eventFlag && 请选择自定义事件!} +
    + + {getFieldDecorator("branch_filter",{ + rules:[] + })( + + )} + + + {getFieldDecorator("active",{ + valuePropName:"checked" + })( + 激活激活后触发事件的信息将发送到此Webhook地址 + )} + + + + { + id && + } +
    +
    + { id && } +
    + ) +} +export default Form.create()(forwardRef(New)); \ No newline at end of file diff --git a/src/forge/Settings/Webhooks/images/fault.png b/src/forge/Settings/Webhooks/images/fault.png new file mode 100755 index 000000000..b2b35295f Binary files /dev/null and b/src/forge/Settings/Webhooks/images/fault.png differ diff --git a/src/forge/Settings/Webhooks/images/icon.png b/src/forge/Settings/Webhooks/images/icon.png new file mode 100644 index 000000000..ae30823fa Binary files /dev/null and b/src/forge/Settings/Webhooks/images/icon.png differ diff --git a/src/forge/Settings/Webhooks/sub/PushHistory.jsx b/src/forge/Settings/Webhooks/sub/PushHistory.jsx new file mode 100644 index 000000000..b9c6a462b --- /dev/null +++ b/src/forge/Settings/Webhooks/sub/PushHistory.jsx @@ -0,0 +1,82 @@ +import React, { useEffect, useState } from 'react'; +import { Button, Collapse , Tooltip , Spin } from 'antd'; +import axios from 'axios'; +import Content from './historyContent'; +import Fault from '../images/fault.png'; +const { Panel } = Collapse; + +function PushHistory({id,owner,projectsId,showNotification}) { + const [ list , setList ] = useState(undefined); + const [ isSpin , setIsSpin ] = useState(false); + + useEffect(()=>{ + if(id && owner && projectsId){ + Init(); + } + },[id,owner,projectsId]) + + function Init() { + const url = `/${owner}/${projectsId}/webhooks/${id}/tasks.json`; + axios.get(url,{ + params:{page:1,limit:10} + }).then(result=>{ + if(result && result.data){ + setList(result.data.tasks); + setIsSpin(false); + } + }).catch(error=>{}) + } + + function testFunc() { + setIsSpin(true); + const url = `/${owner}/${projectsId}/webhooks/${id}/test.json`; + axios.post(url).then(result=>{ + if(result && result.data){ + // Init(); + showNotification("测试推送已经加入到队列,请耐心等待数秒再刷新推送记录!"); + setIsSpin(false); + } + }).catch(error=>{setIsSpin(false);}) + } + + return( +
    +
    + 最近推送历史 + + 刷新 + + +
    + { + list && list.length>0 && + + { + list.map((i,k)=>{ + return( + + { + i.is_succeed ? + 响应成功,类型:{i.response_content && i.response_content.status}}> + + + : + + } + {i.uuid} + {/* {i.type} */} + {i.delivered_time} +
    + }> + + + ) + }) + } + + } + + ) +} +export default PushHistory; \ No newline at end of file diff --git a/src/forge/Settings/Webhooks/sub/historyContent.jsx b/src/forge/Settings/Webhooks/sub/historyContent.jsx new file mode 100644 index 000000000..525da3d86 --- /dev/null +++ b/src/forge/Settings/Webhooks/sub/historyContent.jsx @@ -0,0 +1,142 @@ +import React, { useEffect, useState } from 'react'; +import { Menu } from 'antd'; +import Nodata from '../../../Nodata'; +import ReactJson from 'react-json-view'; +import Editor from "../../../Component/Monaco"; + +function HistoryContent({request_content,payload_content,response_content}) { + const [ key , setKey ] = useState("request"); + const [ requestHeader , setRequestHeader ] = useState(undefined); + const [ responseHeader , setResponseHeader ] = useState(undefined); + + useEffect(()=>{ + if(request_content){ + let arr = []; + Object.keys(request_content).map((item,key)=>{ + arr.push({name:item,value:request_content[item],k:key}); + }) + setRequestHeader(arr); + } + },[request_content]) + + useEffect(()=>{ + if(response_content && response_content.headers){ + let arr = []; + Object.keys(response_content.headers).map((item,key)=>{ + arr.push({name:item,value:response_content.headers[item],k:key}); + }) + setResponseHeader(arr); + } + },[response_content]) + + function isJSON(str) { + if (typeof str === 'string') { + try { + var obj=JSON.parse(str); + if(typeof obj === 'object' && obj ){ + return true; + }else{ + return false; + } + } catch(e) { + return false; + } + } + } + + + + return( +
    +
    + setKey(e.key)} mode={"horizontal"} className="contentMenu"> + 请求 + 响应 + +
    +
    + { + key === "request" ? +
    + { + requestHeader && requestHeader.length > 0 && +
    +

    标题

    +
    + { + requestHeader.map((i,k)=>{ + return( +

    {i.name}: {i.value}

    + ) + }) + } +
    +
    + } + { + payload_content && +
    +

    有效载荷

    +
    + +
    +
    + } +
    + : +
    + { + (!responseHeader && ((response_content && !response_content.body) || !response_content))? + + :"" + } + { + responseHeader && responseHeader.length > 0 && +
    +

    标题

    +
    + { + responseHeader.map((i,k)=>{ + return( +

    {i.name}: {i.value}

    + ) + }) + } +
    +
    + } + { + response_content && response_content.body && +
    +

    响应体

    + { + isJSON(response_content.body) ? +
    + +
    + : +
    + +
    + } +
    + } +
    + } +
    +
    + ) +} +export default HistoryContent; \ No newline at end of file diff --git a/src/forge/css/index.scss b/src/forge/css/index.scss index e8e8e85f4..00e46b6f8 100644 --- a/src/forge/css/index.scss +++ b/src/forge/css/index.scss @@ -257,4 +257,17 @@ form{ .group-setting-switch{ border: 1px solid #DDDDDD !important; background-color: #fff !important; +} +.ant-btn.ant-btn-background-ghost{ + border-color: #D0D0D0; +} +.ant-btn.ant-btn-background-ghost.ant-btn-primary:hover{ + background-color: #1890ff!important; + border-color: #1890ff; + color: #fff; +} +.ant-btn.ant-btn-background-ghost.ant-btn-danger:hover{ + background-color: #DF0002!important; + border-color: #DF0002; + color: #fff; } \ No newline at end of file