text: (window.webpackJsonp=window.webpackJsonp||[]).push([[0],{328:function(e,t,n){e.exports=n(726)},418:function(e,t,n){},726:function(e,t,n){"use strict";n.r(t);var a=n(23),r=n(24),i=n(26),s=n(25),o=n(27),l=n(0),c=n.n(l),u=n(10),d=n.n(u),m=n(94),p=(n(418),n(11)),f=n.n(p),h=n(17),g=(n(421),n(7));function v(e){return e.json()}function y(e){return e.status>=200&&e.status,e}function w(e,t){return fetch(e,t).then(y).then(v).then(function(e){return"L200"===e.code?e:(g.v.error({message:"\u5931\u8d25",description:e.message,duration:20}),e)}).catch(function(e){return e})}function b(){return(b=Object(h.a)(f.a.mark(function e(t){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",w(window.logkitUrl+"/logkit/reader/usages",{method:"get"}));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function k(){return(k=Object(h.a)(f.a.mark(function e(t){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",w(window.logkitUrl+"/logkit/reader/options",{method:"get"}));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function E(){return(E=Object(h.a)(f.a.mark(function e(t){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",w(window.logkitUrl+"/logkit/parser/options",{method:"get"}));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function C(){return(C=Object(h.a)(f.a.mark(function e(t){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",w(window.logkitUrl+"/logkit/parser/usages",{method:"get"}));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function O(){return(O=Object(h.a)(f.a.mark(function e(t){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",w(window.logkitUrl+"/logkit/parser/samplelogs",{method:"get"}));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function S(){return(S=Object(h.a)(f.a.mark(function e(t){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",w(window.logkitUrl+"/logkit/sender/options",{method:"get"}));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function N(){return(N=Object(h.a)(f.a.mark(function e(t){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",w(window.logkitUrl+"/logkit/sender/usages",{method:"get"}));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function T(){return(T=Object(h.a)(f.a.mark(function e(t){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",w(window.logkitUrl+"/logkit/metric/keys",{method:"get"}));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function x(){return(x=Object(h.a)(f.a.mark(function e(t){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",w(window.logkitUrl+"/logkit/metric/usages",{method:"get"}));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function D(){return(D=Object(h.a)(f.a.mark(function e(t){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",w(window.logkitUrl+"/logkit/metric/options",{method:"get"}));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function I(){return(I=Object(h.a)(f.a.mark(function e(t){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",w(window.logkitUrl+"/logkit/configs",{method:"get"}));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function j(){return(j=Object(h.a)(f.a.mark(function e(t){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",w(window.logkitUrl+"/logkit/transformer/options",{method:"get"}));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function U(){return(U=Object(h.a)(f.a.mark(function e(t){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",w(window.logkitUrl+"/logkit/transformer/usages",{method:"get"}));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function _(){return(_=Object(h.a)(f.a.mark(function e(t){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",w(window.logkitUrl+"/logkit/status",{method:"get"}));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function M(){return(M=Object(h.a)(f.a.mark(function e(t){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",w(window.logkitUrl+"/logkit/parser/parse",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.body)}));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function R(e){return F.apply(this,arguments)}function F(){return(F=Object(h.a)(f.a.mark(function e(t){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",w(window.logkitUrl+"/logkit/configs/"+t.name,{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.body)}));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function V(e){return L.apply(this,arguments)}function L(){return(L=Object(h.a)(f.a.mark(function e(t){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",w(window.logkitUrl+"/logkit/configs/"+t.name,{method:"put",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.body)}));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function K(){return(K=Object(h.a)(f.a.mark(function e(t){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",w(window.logkitUrl+"/logkit/configs/"+t.name,{method:"delete"}));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function z(){return(z=Object(h.a)(f.a.mark(function e(t){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",w(window.logkitUrl+"/logkit/version",{method:"get"}));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function q(){return(q=Object(h.a)(f.a.mark(function e(t){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",w(window.logkitUrl+"/logkit/configs/"+t.name+"/start",{method:"post",headers:{"Content-Type":"application/json"}}));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function A(){return(A=Object(h.a)(f.a.mark(function e(t){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",w(window.logkitUrl+"/logkit/configs/"+t.name+"/stop",{method:"post",headers:{"Content-Type":"application/json"}}));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function J(){return(J=Object(h.a)(f.a.mark(function e(t){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",w(window.logkitUrl+"/logkit/configs/"+t.name+"/reset",{method:"post",headers:{"Content-Type":"application/json"}}));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Y(e){return H.apply(this,arguments)}function H(){return(H=Object(h.a)(f.a.mark(function e(t){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",w(window.logkitUrl+"/logkit/cluster/configs/"+t.name+"?tag="+t.tag+"&url="+t.url,{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.body)}));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function W(e){return P.apply(this,arguments)}function P(){return(P=Object(h.a)(f.a.mark(function e(t){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",w(window.logkitUrl+"/logkit/cluster/configs/"+t.name+"?tag="+t.tag+"&url="+t.url,{method:"put",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.body)}));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function B(){return(B=Object(h.a)(f.a.mark(function e(t){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",w(window.logkitUrl+"/logkit/cluster/configs?tag="+t.tag+"&url="+t.machineUrl,{method:"get"}));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function G(){return(G=Object(h.a)(f.a.mark(function e(t){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",w(window.logkitUrl+"/logkit/cluster/status?tag="+t.tag+"&url="+t.machineUrl,{method:"get"}));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function $(e){return Q.apply(this,arguments)}function Q(){return(Q=Object(h.a)(f.a.mark(function e(t){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",w(window.logkitUrl+"/logkit/cluster/slaves",{method:"get"}));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function X(e){return Z.apply(this,arguments)}function Z(){return(Z=Object(h.a)(f.a.mark(function e(t){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",w(window.logkitUrl+"/logkit/cluster/slaves/tag?tag="+t.name+"&url="+t.url,{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.body)}));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function ee(e){return te.apply(this,arguments)}function te(){return(te=Object(h.a)(f.a.mark(function e(t){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",w(window.logkitUrl+"/logkit/cluster/slaves?tag="+t.name+"&url="+t.url,{method:"delete"}));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function ne(){return(ne=Object(h.a)(f.a.mark(function e(t){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",w(window.logkitUrl+"/logkit/cluster/configs/"+t.name+"/stop?tag="+t.tag+"&url="+t.url,{method:"post"}));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function ae(){return(ae=Object(h.a)(f.a.mark(function e(t){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",w(window.logkitUrl+"/logkit/cluster/configs/"+t.name+"/reset?tag="+t.tag+"&url="+t.url,{method:"post"}));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function re(e){return ie.apply(this,arguments)}function ie(){return(ie=Object(h.a)(f.a.mark(function e(t){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",w(window.logkitUrl+"/logkit/cluster/configs/"+t.name+"/start?tag="+t.tag+"&url="+t.url,{method:"post",headers:{"Content-Type":"application/json"}}));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function se(){return(se=Object(h.a)(f.a.mark(function e(t){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",w(window.logkitUrl+"/logkit/cluster/configs/"+t.name+"?tag="+t.tag+"&url="+t.url,{method:"delete"}));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function oe(){return(oe=Object(h.a)(f.a.mark(function e(t){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",w(window.logkitUrl+"/logkit/cluster/configs/"+t.name+"/stop?tag="+t.tag+"&url="+t.url,{method:"post",headers:{"Content-Type":"application/json"}}));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function le(){return(le=Object(h.a)(f.a.mark(function e(t){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",w(window.logkitUrl+"/logkit/cluster/configs/"+t.name+"/reset?tag="+t.tag+"&url="+t.url,{method:"post",headers:{"Content-Type":"application/json"}}));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function ce(){return(ce=Object(h.a)(f.a.mark(function e(t){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",w(window.logkitUrl+"/logkit/cluster/configs/"+t.name+"?tag="+t.tag+"&url="+t.url,{method:"delete"}));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function ue(){return(ue=Object(h.a)(f.a.mark(function e(t){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",w(window.logkitUrl+"/logkit/cluster/configs/"+t.name+"?tag="+t.tag+"&url="+t.url,{method:"get"}));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function de(){return(de=Object(h.a)(f.a.mark(function e(t){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",w(window.logkitUrl+"/logkit/cluster/ismaster",{method:"get"}));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function me(){return(me=Object(h.a)(f.a.mark(function e(t){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",w(window.logkitUrl+"/logkit/cluster/runners?tag="+t.tag+"&url="+t.url,{method:"get"}));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}window.logkitUrl="";var pe=n(46),fe=n(36),he={};window.nodes={},he.get=function(e){return window.nodes[e]},he.set=function(e,t){window.nodes[e]=t},he.delete=function(e){delete window.nodes[e]},he.getNodeData=function(){return window.nodes},he.setNodeData=function(e){return window.nodes=e};var ge=he,ve=n(14),ye=n.n(ve),we=g.q.Option,be=g.f.Item,ke={labelCol:{xs:{span:24},sm:{span:7}},wrapperCol:{xs:{span:24},sm:{span:10}}},Ee={labelCol:{xs:{span:24},sm:{span:7}},wrapperCol:{xs:{span:24},sm:{span:10}}},Ce=["file","fileauto","dir","tailx"],Oe=[{KeyName:"delete_enable",Default:"false",Label:"\u662f\u5426\u81ea\u52a8\u5220\u9664\u65e5\u5fd7\u6587\u4ef6"},{KeyName:"delete_interval",Default:"10",Label:"\u5220\u9664\u6267\u884c\u5468\u671f",Unit:"\u79d2"},{KeyName:"reserve_file_number",Default:"10",Label:"\u6700\u5927\u4fdd\u7559\u5df2\u8bfb\u6587\u4ef6\u6570"},{KeyName:"reserve_file_size",Default:"2048",Label:"\u6700\u5927\u4fdd\u7559\u5df2\u8bfb\u6587\u4ef6\u603b\u5927\u5c0f",Unit:"MB"}],Se=function(e){function t(e){var n;return Object(a.a)(this,t),(n=Object(i.a)(this,Object(s.a)(t).call(this,e))).submit=function(){var e=n.props.form.getFieldsValue,t=Oe.map(function(e){return e.KeyName}),a=e(),r=[],i=[],s=!0,o=!1,l=void 0;try{for(var c,u=n.state.currentItem[Symbol.iterator]();!(s=(c=u.next()).done);s=!0){var d=c.value;d.advance_depend&&a[n.state.currentOption]&&"false"===a[n.state.currentOption][d.advance_depend]&&(a[n.state.currentOption][d.KeyName]="")}}catch(p){o=!0,l=p}finally{try{s||null==u.return||u.return()}finally{if(o)throw l}}ye.a.forIn(a[n.state.currentOption],function(e,n){""!==e&&(t.includes(n)?i.push(n):r.push(n))});var m=ye.a.pick(a[n.state.currentOption],i);m&&"boolean"===typeof m.delete_enable&&(m.delete_enable?m.delete_enable=m.delete_enable.toString():m={},console.log(m)),ge.set("reader",ye.a.pick(a[n.state.currentOption],r)),ge.set("cleaner",m)},n.init=function(){var e=n.props.form,t=e.setFieldsValue,a=e.resetFields,r=Object(fe.a)(n);(function(e){return b.apply(this,arguments)})().then(function(e){"L200"===e.code&&(n.setState({options:e.data,currentOption:e.data[0].key}),function(e){return k.apply(this,arguments)}().then(function(e){if("L200"===e.code&&(n.setState({items:e.data,currentItem:e.data[n.state.currentOption]}),window.nodeCopy)){r.handleChange(window.nodeCopy.reader.mode),a();var i={};i[window.nodeCopy.reader.mode]=Object(pe.a)({},window.nodeCopy.reader,window.nodeCopy.cleaner),r.setState({currentOption:window.nodeCopy.reader.mode}),t(i)}}))})},n.renderFormItem=function(){var e=n.props.form,t=e.getFieldDecorator,a=e.getFieldValue,r=[],i=[];return n.state.currentItem.map(function(e,s){var o=null,l=c.a.createElement("span",null,e.Description.slice(0,e.Description.indexOf("(")),c.a.createElement("br",null),c.a.createElement("span",{style:{color:"rgba(0,0,0,.43)",float:"right"}},e.Description.slice(e.Description.indexOf("("),e.Description.length))),u=e.advance_depend&&a("".concat(n.state.currentOption,".").concat(e.advance_depend)),d="false"===u||!1===u;if(o=0==e.ChooseOnly?c.a.createElement(be,Object.assign({key:s},ke,{className:d?"hide-div":"show-div",label:l}),t("".concat(n.state.currentOption,".").concat(e.KeyName),{initialValue:e.Default,rules:[{required:e.required&&!d,message:"\u4e0d\u80fd\u4e3a\u7a7a",trigger:"blur"},{pattern:e.CheckRegex,message:"\u8f93\u5165\u4e0d\u7b26\u5408\u89c4\u8303"}]})("text"===e.Element?c.a.createElement(g.h.TextArea,{placeholder:e.DefaultNoUse?e.placeholder:"\u7a7a\u503c\u53ef\u4f5c\u4e3a\u9ed8\u8ba4\u503c",disabled:n.state.isReadonly}):c.a.createElement(g.h,{placeholder:e.DefaultNoUse?e.placeholder:"\u7a7a\u503c\u53ef\u4f5c\u4e3a\u9ed8\u8ba4\u503c",disabled:n.state.isReadonly}))):c.a.createElement(be,Object.assign({key:s},ke,{className:d?"hide-div":"show-div",label:l}),t("".concat(n.state.currentOption,".").concat(e.KeyName),{initialValue:e.Default||e.ChooseOptions[0],rules:[{required:e.required&&!d,message:"\u4e0d\u80fd\u4e3a\u7a7a",trigger:"blur"}]})(c.a.createElement(g.q,null,n.renderChooseOption(e.ChooseOptions)))),e&&e.advance)if(e.advance_depend){var m=n.getAdvancedConfig(e);m&&m.advance?i.push(o):n.state.advanceChecked&&r.push(o)}else i.push(o);else r.push(o)}),{result:r,advancedResults:i}},n.getAdvancedConfig=function(e){if(e.advance_depend)return n.state.currentItem.find(function(t){return t.KeyName===e.advance_depend})},n.handleChange=function(e){n.setState({currentOption:e,currentItem:n.state.items[e]})},n.renderSelectOptions=function(){var e=[];return n.state.options.map(function(t){e.push(c.a.createElement(we,{key:t.key,value:t.key},t.value))}),e},n.renderChooseOption=function(e){var t=[];return e.map(function(e){t.push(c.a.createElement(we,{key:e,value:e},e))}),t},n.renderExtraFormItem=function(){var e=n.state.currentOption,t=n.props.form,a=t.getFieldDecorator,r=t.getFieldValue;t.setFieldsValue;if(Ce.includes(e)){var i=Oe.filter(function(e){return"delete_enable"!==e.KeyName}),s=r("".concat(n.state.currentOption,".delete_enable"));return c.a.createElement("div",null,c.a.createElement(be,Object.assign({},ke,{className:"delete_enable",label:c.a.createElement("span",null,"\u662f\u5426\u81ea\u52a8\u5220\u9664\u65e5\u5fd7\u6587\u4ef6",c.a.createElement("br",null))}),a("".concat(n.state.currentOption,".delete_enable"),{initialValue:!1})(c.a.createElement(g.c,{checked:!!s},"\u81ea\u52a8\u5220\u9664"))),c.a.createElement("div",{className:s?"show-div":"hide-div"},i.map(function(e){return c.a.createElement(be,Object.assign({key:e.KeyName},ke,{className:"delete-enable-input-number",label:c.a.createElement("span",null,e.Label,c.a.createElement("br",null))}),a("".concat(n.state.currentOption,".").concat(e.KeyName),{initialValue:e.Default})(c.a.createElement(g.h,null)),e.Unit)})))}},n.state={current:0,items:[],options:[],currentOption:"",currentItem:[],advanceChecked:!1,enableDelete:!1},n}return Object(o.a)(t,e),Object(r.a)(t,[{key:"componentDidMount",value:function(){this.init()}},{key:"componentWillUnmount",value:function(){}},{key:"componentDidUpdate",value:function(e){this.submit()}},{key:"componentWillReceiveProps",value:function(e){}},{key:"render",value:function(){var e=this,t=this.props.form.getFieldDecorator,n=this.renderFormItem();return c.a.createElement("div",null,c.a.createElement(g.f,{className:"slide-in text-color"},c.a.createElement(be,Object.assign({},Ee,{label:"\u9009\u62e9\u6570\u636e\u6e90\u7c7b\u578b"}),t("".concat(this.state.currentOption,".mode"),{initialValue:this.state.currentOption})(c.a.createElement(g.q,{onChange:this.handleChange},this.renderSelectOptions()))),c.a.createElement("div",{className:"ant-divider ant-divider-horizontal"}),n.result,this.renderExtraFormItem(),n.advancedResults.length>0?c.a.createElement("div",null,c.a.createElement("div",{className:"ant-divider ant-divider-horizontal ant-divider-with-text"},c.a.createElement(g.c,{onChange:function(t){e.setState({advanceChecked:t.target.checked})},className:"ant-divider-inner-text"},"\u9ad8\u7ea7\u9009\u9879")),c.a.createElement("div",{className:this.state.advanceChecked?"show-div":"hide-div"},n.advancedResults)):null))}}]),t}(l.Component),Ne=g.f.create()(Se),Te=n(16),xe=n.n(Te),De=g.q.Option,Ie=g.f.Item,je={labelCol:{xs:{span:24},sm:{span:7}},wrapperCol:{xs:{span:24},sm:{span:10}}},Ue={labelCol:{xs:{span:24},sm:{span:7}},wrapperCol:{xs:{span:24},sm:{span:10}}},_e=function(e){function t(e){var n;return Object(a.a)(this,t),(n=Object(i.a)(this,Object(s.a)(t).call(this,e))).submit=function(){var e=(0,n.props.form.getFieldsValue)(),t=[],a=!0,r=!1,i=void 0;try{for(var s,o=n.state.currentItem[Symbol.iterator]();!(a=(s=o.next()).done);a=!0){var l=s.value;l.advance_depend&&e[n.state.currentOption]&&"false"===e[n.state.currentOption][l.advance_depend]&&(e[n.state.currentOption][l.KeyName]="")}}catch(c){r=!0,i=c}finally{try{a||null==o.return||o.return()}finally{if(r)throw i}}ye.a.forIn(e[n.state.currentOption],function(e,n){""!==e&&t.push(n)}),ge.set("parser",ye.a.pick(e[n.state.currentOption],t))},n.init=function(){var e=n.props.form,t=e.getFieldDecorator,a=e.setFieldsValue,r=e.resetFields,i=Object(fe.a)(n);(function(e){return C.apply(this,arguments)})().then(function(e){"L200"===e.code&&(n.setState({options:e.data,currentOption:e.data[0].key}),function(e){return E.apply(this,arguments)}().then(function(e){if("L200"===e.code&&(n.setState({items:e.data,currentItem:e.data[n.state.currentOption]}),window.nodeCopy)){i.handleChange(window.nodeCopy.parser.type),r();var t={};t[window.nodeCopy.parser.type]=window.nodeCopy.parser,i.setState({currentOption:window.nodeCopy.parser.type}),a(t)}}))}),function(e){return O.apply(this,arguments)}().then(function(e){"L200"===e.code&&(n.setState({sampleData:e.data,currentSampleData:e.data[n.state.currentOption]}),t("sampleData",{initialValue:e.data[n.state.currentOption]}))})},n.renderFormItem=function(){var e=n.props.form,t=e.getFieldDecorator,a=e.getFieldValue,r=[],i=[];return n.state.currentItem.map(function(e,s){var o=null,l=c.a.createElement("span",null,e.Description.slice(0,e.Description.indexOf("(")),c.a.createElement("br",null),c.a.createElement("span",{style:{color:"rgba(0,0,0,.43)",float:"right"}},e.Description.slice(e.Description.indexOf("("),e.Description.length))),u=e.advance_depend&&a("".concat(n.state.currentOption,".").concat(e.advance_depend)),d="false"===u||!1===u;if(0==e.ChooseOnly?("name"==e.KeyName&&1!=window.isCopy&&(e.Default="pandora.parser."+xe()().format("YYYYMMDDHHmmss")),o="grok_custom_patterns"===e.KeyName?c.a.createElement(Ie,Object.assign({key:s},je,{label:l}),t("".concat(n.state.currentOption,".").concat(e.KeyName),{initialValue:e.DefaultNoUse?"":e.Default,rules:[{required:e.required,message:"\u4e0d\u80fd\u4e3a\u7a7a",trigger:"blur"},{pattern:e.CheckRegex,message:"\u8f93\u5165\u4e0d\u7b26\u5408\u89c4\u8303"}]})(c.a.createElement(g.h,{type:"textarea",rows:"6",placeholder:e.DefaultNoUse?e.placeholder:"\u7a7a\u503c\u53ef\u4f5c\u4e3a\u9ed8\u8ba4\u503c",disabled:n.state.isReadonly}))):c.a.createElement(Ie,Object.assign({key:s},je,{className:d?"hide-div":"show-div",label:l}),t("".concat(n.state.currentOption,".").concat(e.KeyName),{initialValue:e.Default,rules:[{required:e.required&&!d,message:"\u4e0d\u80fd\u4e3a\u7a7a",trigger:"blur"},{pattern:e.CheckRegex,message:"\u8f93\u5165\u4e0d\u7b26\u5408\u89c4\u8303"}]})("csv_schema"===e.KeyName?c.a.createElement("div",null,c.a.createElement(g.h.TextArea,{placeholder:e.DefaultNoUse?e.placeholder:"\u7a7a\u503c\u53ef\u4f5c\u4e3a\u9ed8\u8ba4\u503c",disabled:n.state.isReadonly,autosize:{minRows:3,maxRows:6}}),a("csv.csv_schema")?c.a.createElement("span",{style:{float:"right",color:"rgb(0,0,0,0.48)",fontSize:11}},"\u5df2\u6709[".concat(a("csv.csv_schema").split(a("csv.csv_splitter")||",").length,"]\u4e2aschema")):null):c.a.createElement(g.h,{placeholder:e.DefaultNoUse?e.placeholder:"\u7a7a\u503c\u53ef\u4f5c\u4e3a\u9ed8\u8ba4\u503c",disabled:n.state.isReadonly})))):o=c.a.createElement(Ie,Object.assign({key:s},je,{className:d?"hide-div":"show-div",label:l}),t("".concat(n.state.currentOption,".").concat(e.KeyName),{initialValue:e.Default||e.ChooseOptions[0],rules:[{required:e.required&&!d,message:"\u4e0d\u80fd\u4e3a\u7a7a",trigger:"blur"}]})(c.a.createElement(g.q,null,n.renderChooseOption(e.ChooseOptions)))),e&&e.advance)if(e.advance_depend){var m=n.getAdvancedConfig(e);m&&m.advance?i.push(o):n.state.advanceChecked&&r.push(o)}else i.push(o);else r.push(o)}),{result:r,advancedResults:i}},n.getAdvancedConfig=function(e){if(e.advance_depend)return n.state.currentItem.find(function(t){return t.KeyName===e.advance_depend})},n.handleChange=function(e){var t=n.props.form,a=t.getFieldDecorator,r=t.resetFields;n.setState({currentOption:e,currentItem:n.state.items[e],currentSampleData:n.state.sampleData[e]}),n.setState({parseData:""}),r(),a("sampleData",{initialValue:n.state.sampleData[e]})},n.renderSelectOptions=function(){var e=[];return n.state.options.map(function(t){e.push(c.a.createElement(De,{key:t.key,value:t.key},t.value))}),e},n.renderChooseOption=function(e){var t=[];return e.map(function(e){t.push(c.a.createElement(De,{key:e,value:e},e))}),t},n.parseSampleData=function(){var e=(0,n.props.form.getFieldsValue)();"grok"===n.state.currentOption&&""!=e[n.state.currentOption].grok_custom_patterns&&void 0!=e[n.state.currentOption].grok_custom_patterns&&(e[n.state.currentOption].grok_custom_patterns=window.btoa(encodeURIComponent(e[n.state.currentOption].grok_custom_patterns))),function(e){return M.apply(this,arguments)}({body:Object(pe.a)({type:n.state.currentOption},e[n.state.currentOption],{sampleLog:e.sampleData})}).then(function(e){"L200"===e.code&&n.setState({parseData:JSON.stringify(ye.a.pick(e.data,"SamplePoints"),null,2)})})},n.state={current:0,items:[],options:[],currentOption:"",currentItem:[],parseData:"",sampleData:[],currentSampleData:"",advanceChecked:!1},n}return Object(o.a)(t,e),Object(r.a)(t,[{key:"componentDidMount",value:function(){this.init()}},{key:"componentWillUnmount",value:function(){}},{key:"componentDidUpdate",value:function(e){this.submit()}},{key:"render",value:function(){var e=this,t=this.props.form.getFieldDecorator,n=this.renderFormItem();return c.a.createElement("div",null,c.a.createElement(g.f,{className:"slide-in text-color"},c.a.createElement(Ie,Object.assign({},Ue,{label:"\u9009\u62e9\u89e3\u6790\u65b9\u5f0f"}),t("".concat(this.state.currentOption,".type"),{initialValue:this.state.currentOption})(c.a.createElement(g.q,{onChange:this.handleChange},this.renderSelectOptions()))),c.a.createElement("div",{className:"ant-divider ant-divider-horizontal"}),n.result,n.advancedResults.length>0?c.a.createElement("div",null,c.a.createElement("div",{className:"ant-divider ant-divider-horizontal ant-divider-with-text"},c.a.createElement(g.c,{onChange:function(t){e.setState({advanceChecked:t.target.checked})},className:"ant-divider-inner-text"},"\u9ad8\u7ea7\u9009\u9879")),c.a.createElement("div",{className:this.state.advanceChecked?"show-div":"hide-div"},n.advancedResults)):null,c.a.createElement(Ie,Object.assign({},Ue,{style:{transform:"translate(70%, 100%)"}}),c.a.createElement(g.b,{type:"primary",onClick:this.parseSampleData,className:"option-add-tag-btn",style:{width:120}},"\u89e3\u6790\u6837\u4f8b\u6570\u636e")),c.a.createElement(Ie,Object.assign({label:"\u8f93\u5165\u6837\u4f8b\u65e5\u5fd7"},Ue),t("sampleData",{rules:[]})(c.a.createElement(g.h,{type:"textarea",rows:"8"}))),c.a.createElement(Ie,Object.assign({},Ue,{label:"\u6837\u4f8b\u65e5\u5fd7"}),c.a.createElement(g.h,{type:"textarea",value:this.state.parseData,rows:"15"}))))}}]),t}(l.Component),Me=g.f.create()(_e),Re=g.q.Option,Fe=g.f.Item,Ve={labelCol:{xs:{span:24},sm:{span:7}},wrapperCol:{xs:{span:24},sm:{span:10}}},Le={labelCol:{xs:{span:24},sm:{span:7}},wrapperCol:{xs:{span:24},sm:{span:10}}},Ke=function(e){function t(e){var n;return Object(a.a)(this,t),(n=Object(i.a)(this,Object(s.a)(t).call(this,e))).submit=function(){var e=(0,n.props.form.getFieldsValue)();e[n.state.currentOption].sender_type=n.state.currentOption;var t=!0,a=!1,r=void 0;try{for(var i,s=n.state.currentItem[Symbol.iterator]();!(t=(i=s.next()).done);t=!0){var o=i.value;o.advance_depend&&e[n.state.currentOption]&&"false"===e[n.state.currentOption][o.advance_depend]&&(e[n.state.currentOption][o.KeyName]="")}}catch(c){a=!0,r=c}finally{try{t||null==s.return||s.return()}finally{if(a)throw r}}var l=[];ye.a.forIn(e[n.state.currentOption],function(e,t){""!=e&&l.push(t)}),ge.set("senders",[ye.a.pick(e[n.state.currentOption],l)])},n.init=function(){var e=n.props.form,t=e.setFieldsValue,a=e.resetFields,r=Object(fe.a)(n),i=n.props.isMetric,s=["true","false"],o=["false","true"];(function(e){return N.apply(this,arguments)})().then(function(e){"L200"===e.code&&(n.setState({options:e.data,currentOption:e.data[0].key}),function(e){return S.apply(this,arguments)}().then(function(e){if("L200"===e.code&&("pandora"in e.data&&e.data.pandora.forEach(function(t,n,a){"true"===i?"pandora_extra_info"===t.KeyName&&(e.data.pandora[n].ChooseOptions=s):"pandora_extra_info"===t.KeyName&&(e.data.pandora[n].ChooseOptions=o)}),n.setState({items:e.data,currentItem:e.data[n.state.currentOption]}),window.nodeCopy)){r.handleChange(window.nodeCopy.senders[0].sender_type),a();var l={};l[window.nodeCopy.senders[0].sender_type]=window.nodeCopy.senders[0],r.setState({currentOption:window.nodeCopy.senders[0].sender_type}),t(l)}}))})},n.renderFormItem=function(){var e=n.props.form,t=e.getFieldDecorator,a=e.getFieldValue,r=[],i=[];return n.state.currentItem.map(function(e,s){var o=null,l=c.a.createElement("span",null,e.Description.slice(0,e.Description.indexOf("(")),c.a.createElement("br",null),c.a.createElement("span",{style:{color:"rgba(0,0,0,.43)",float:"right"}},e.Description.slice(e.Description.indexOf("("),e.Description.length))),u=e.advance_depend&&a("".concat(n.state.currentOption,".").concat(e.advance_depend)),d="false"===u||!1===u;if(0==e.ChooseOnly?("name"==e.KeyName&&1!=window.isCopy&&(e.Default="pandora.sender."+xe()().format("YYYYMMDDHHmmss")),o=c.a.createElement(Fe,Object.assign({key:s},Ve,{className:d?"hide-div":"show-div",label:l}),t("".concat(n.state.currentOption,".").concat(e.KeyName),{initialValue:e.Default,rules:[{required:e.required&&!d,message:"\u4e0d\u80fd\u4e3a\u7a7a",trigger:"blur"},{pattern:e.CheckRegex,message:"\u8f93\u5165\u4e0d\u7b26\u5408\u89c4\u8303"}]})(c.a.createElement(g.h,{placeholder:e.DefaultNoUse?e.placeholder:"\u7a7a\u503c\u53ef\u4f5c\u4e3a\u9ed8\u8ba4\u503c",disabled:n.state.isReadonly})))):o=c.a.createElement(Fe,Object.assign({key:s},Ve,{className:d?"hide-div":"show-div",label:l}),t("".concat(n.state.currentOption,".").concat(e.KeyName),{initialValue:e.Default||e.ChooseOptions[0],rules:[{required:e.required&&!d,message:"\u4e0d\u80fd\u4e3a\u7a7a",trigger:"blur"}]})(c.a.createElement(g.q,null,n.renderChooseOption(e.ChooseOptions)))),e&&e.advance)if(e.advance_depend){var m=n.getAdvancedConfig(e);m&&m.advance?i.push(o):n.state.advanceChecked&&r.push(o)}else i.push(o);else r.push(o)}),{result:r,advancedResults:i}},n.getAdvancedConfig=function(e){if(e.advance_depend)return n.state.currentItem.find(function(t){return t.KeyName===e.advance_depend})},n.handleChange=function(e){n.setState({currentOption:e,currentItem:n.state.items[e]})},n.renderSelectOptions=function(){var e=[];return n.state.options.map(function(t){e.push(c.a.createElement(Re,{key:t.key,value:t.key},t.value))}),e},n.renderChooseOption=function(e){var t=[];return e.map(function(e){t.push(c.a.createElement(Re,{key:e,value:e},e))}),t},n.state={current:0,items:[],options:[],currentOption:"",currentItem:[],advanceChecked:!1},n}return Object(o.a)(t,e),Object(r.a)(t,[{key:"componentDidMount",value:function(){this.init()}},{key:"componentWillUnmount",value:function(){}},{key:"componentDidUpdate",value:function(e){this.submit()}},{key:"render",value:function(){var e=this,t=this.props.form.getFieldDecorator,n=this.renderFormItem();return c.a.createElement("div",null,c.a.createElement(g.f,{className:"slide-in text-color"},c.a.createElement(Fe,Object.assign({},Le,{label:"\u9009\u62e9\u6570\u636e\u6e90\u7c7b\u578b"}),t("".concat(this.state.currentOption,".sender_type"),{initialValue:this.state.currentOption})(c.a.createElement(g.q,{onChange:this.handleChange},this.renderSelectOptions()))),c.a.createElement("div",{className:"ant-divider ant-divider-horizontal"}),n.result,n.advancedResults.length>0?c.a.createElement("div",null,c.a.createElement("div",{className:"ant-divider ant-divider-horizontal ant-divider-with-text"},c.a.createElement(g.c,{onChange:function(t){e.setState({advanceChecked:t.target.checked})},className:"ant-divider-inner-text"},"\u9ad8\u7ea7\u9009\u9879")),c.a.createElement("div",{className:this.state.advanceChecked?"show-div":"hide-div"},n.advancedResults)):null))}}]),t}(l.Component),ze=g.f.create()(Ke),qe=g.q.Option,Ae=g.f.Item,Je=g.o.Group,Ye={labelCol:{xs:{span:24},sm:{span:0}},wrapperCol:{xs:{span:24},sm:{span:24}}},He={labelCol:{xs:{span:24},sm:{span:6}},wrapperCol:{xs:{span:24},sm:{span:11}}},We=function(e){function t(e){var n;return Object(a.a)(this,t),(n=Object(i.a)(this,Object(s.a)(t).call(this,e))).renderConfigFile=function(){var e=n.props.form,t=e.getFieldDecorator,a=e.resetFields,r="logkit.runner."+xe()().format("YYYYMMDDHHmmss"),i=Object(pe.a)({name:r},ge.getNodeData());n.setState({currentConfig:JSON.stringify(i,null,2)}),t("config",{initialValue:JSON.stringify(i,null,2)});n.state.currentConfig,a()},n.isJSON=function(e){if("string"===typeof e)try{return JSON.parse(e),!0}catch(t){return!1}},n.handleIntervalChange=function(e){var t=n.props.form,a=t.getFieldsValue,r=t.getFieldDecorator,i=t.resetFields,s=a();if(n.closeNotification(),n.isJSON(s.config)){var o=JSON.parse(s.config);o.batch_interval=e,i(),r("config",{initialValue:JSON.stringify(o,null,2)}),r("name",{initialValue:s.name}),r("extra_info",{initialValue:s.extra_info}),r("collect_interval",{initialValue:parseInt(s.collect_interval)}),r("batch_size",{initialValue:parseInt(s.batch_size)})}else n.notifyJSONError()},n.handleBatchSizeChange=function(e){var t=n.props.form,a=t.getFieldsValue,r=t.getFieldDecorator,i=t.resetFields,s=a();if(n.closeNotification(),n.isJSON(s.config)){var o=JSON.parse(s.config);o.batch_size=e,i(),r("config",{initialValue:JSON.stringify(o,null,2)}),r("name",{initialValue:s.name}),r("extra_info",{initialValue:s.extra_info}),r("collect_interval",{initialValue:parseInt(s.collect_interval)}),r("batch_interval",{initialValue:parseInt(s.batch_interval)})}else n.notifyJSONError()},n.handleMetricIntervalChange=function(e){var t=n.props.form,a=t.getFieldsValue,r=t.getFieldDecorator,i=t.resetFields,s=a();if(n.closeNotification(),n.isJSON(s.config)){var o=JSON.parse(s.config);o.collect_interval=e,i(),r("config",{initialValue:JSON.stringify(o,null,2)}),r("name",{initialValue:s.name}),r("batch_interval",{initialValue:parseInt(s.batch_interval)}),r("batch_size",{initialValue:parseInt(s.batch_size)}),r("extra_info",{initialValue:s.extra_info})}else n.notifyJSONError()},n.handleNameChange=function(e){var t=n.props.form,a=t.getFieldsValue,r=t.getFieldDecorator,i=t.resetFields,s=a();if(n.closeNotification(),n.isJSON(s.config)){var o=JSON.parse(s.config);o.name=e.target.value,i(),r("config",{initialValue:JSON.stringify(o,null,2)}),r("batch_interval",{initialValue:parseInt(s.batch_interval)}),r("batch_size",{initialValue:parseInt(s.batch_size)}),r("collect_interval",{initialValue:parseInt(s.collect_interval)}),r("extra_info",{initialValue:s.extra_info})}else n.notifyJSONError()},n.handleExtraInfoChange=function(e){var t=n.props.form,a=t.getFieldsValue,r=t.getFieldDecorator,i=t.resetFields,s=a();if(n.closeNotification(),n.isJSON(s.config)){var o=JSON.parse(s.config);o.extra_info="true"===e.target.value,i(),r("config",{initialValue:JSON.stringify(o,null,2)}),r("batch_interval",{initialValue:parseInt(s.batch_interval)}),r("batch_size",{initialValue:parseInt(s.batch_size)}),r("collect_interval",{initialValue:parseInt(s.collect_interval)}),r("name",{initialValue:s.name})}else n.notifyJSONError()},n.handleConfigChange=function(e){var t=n.props.form,a=t.getFieldDecorator,r=t.resetFields;if(n.closeNotification(),n.isJSON(e.target.value)){var i=JSON.parse(e.target.value);r(),a("name",{initialValue:i.name}),a("batch_interval",{initialValue:parseInt(i.batch_interval)}),a("collect_interval",{initialValue:parseInt(i.collect_interval)}),a("batch_size",{initialValue:parseInt(i.batch_size)}),a("extra_info",{initialValue:i.extra_info.toString()})}else n.notifyJSONError()},n.renderSelectOptions=function(e){var t=[];return void 0!=e&&e.map(function(e){t.push(c.a.createElement(qe,{key:e,value:e},e))}),t},n.state={current:0,machines:[]},n.notifyJSONError=ye.a.debounce(function(){this.notification=g.v.warning({message:"\u4e0d\u662f\u4e00\u4e2a\u5408\u6cd5\u7684json\u5bf9\u8c61,\u8bf7\u68c0\u67e5",duration:10})},500),n}return Object(o.a)(t,e),Object(r.a)(t,[{key:"componentDidMount",value:function(){}},{key:"componentWillUnmount",value:function(){}},{key:"componentDidUpdate",value:function(e){}},{key:"closeNotification",value:function(){g.v.destroy()}},{key:"render",value:function(){var e=this.props.form.getFieldDecorator,t=this.props.isMetric;return c.a.createElement("div",null,c.a.createElement("div",{className:"logkit-body"},c.a.createElement(g.p,null,c.a.createElement(g.f,null,c.a.createElement(Ae,Object.assign({},He,{label:"\u540d\u79f0"}),e("name",{rules:[{required:!0,message:"\u540d\u79f0\u4e0d\u80fd\u4e3a\u7a7a"}]})(c.a.createElement(g.h,{onChange:this.handleNameChange,placeholder:"\u6536\u96c6\u5668(runner)\u540d\u79f0",disabled:!!window.isCopy}))),c.a.createElement(Ae,Object.assign({},He,{label:c.a.createElement("span",null,"\u6700\u957f\u53d1\u9001\u95f4\u9694",c.a.createElement("br",null),c.a.createElement("span",{style:{color:"rgba(0,0,0,.43)",float:"right"}},"(\u79d2)"))}),e("batch_interval",{rules:[{required:!0,message:"\u53d1\u9001\u95f4\u9694\u4e0d\u80fd\u4e3a\u7a7a"},{pattern:/^[0-9]*$/,message:"\u8f93\u5165\u4e0d\u7b26\u5408\u89c4\u8303,\u53ea\u80fd\u4e3a\u6574\u6570"}]})(c.a.createElement(g.i,{onChange:this.handleIntervalChange,placeholder:"\u53d1\u9001\u95f4\u9694\u5355\u4f4d(\u79d2)"}))),t?c.a.createElement(Ae,Object.assign({},He,{label:c.a.createElement("span",null,"\u7cfb\u7edf\u4fe1\u606f\u6536\u96c6\u95f4\u9694",c.a.createElement("br",null),c.a.createElement("span",{style:{color:"rgba(0,0,0,.43)",float:"right"}},"(\u79d2)"))}),e("collect_interval",{rules:[{required:!0,message:"\u6536\u96c6\u95f4\u9694\u4e0d\u80fd\u4e3a\u7a7a"},{pattern:/^[0-9]*$/,message:"\u8f93\u5165\u4e0d\u7b26\u5408\u89c4\u8303,\u53ea\u80fd\u4e3a\u6574\u6570"}]})(c.a.createElement(g.i,{onChange:this.handleMetricIntervalChange,placeholder:"\u7cfb\u7edf\u4fe1\u606f\u6536\u96c6\u95f4\u9694\u5355\u4f4d(\u79d2)"}))):null,c.a.createElement(Ae,Object.assign({},He,{label:c.a.createElement("span",null,"\u5355\u6b21\u8bfb\u53d6\u6700\u5927\u6570\u636e\u91cf",c.a.createElement("br",null),c.a.createElement("span",{style:{color:"rgba(0,0,0,.43)",float:"right"}},"(byte)"))}),e("batch_size",{rules:[{required:!0,message:"\u5355\u6b21\u8bfb\u53d6\u6700\u5927\u6570\u636e\u91cf\u4e0d\u80fd\u4e3a\u7a7a"},{pattern:/^[0-9]*$/,message:"\u8f93\u5165\u4e0d\u7b26\u5408\u89c4\u8303,\u53ea\u80fd\u4e3a\u6574\u6570"}]})(c.a.createElement(g.i,{onChange:this.handleBatchSizeChange}))),c.a.createElement(Ae,Object.assign({},He,{label:"\u6dfb\u52a0\u989d\u5916\u7cfb\u7edf\u4fe1\u606f"}),e("extra_info")(c.a.createElement(Je,{onChange:this.handleExtraInfoChange,style:{float:"left"}},c.a.createElement(g.o,{value:"true"},"true"),c.a.createElement(g.o,{value:"false"},"false")))),c.a.createElement(Ae,Ye,e("config",{rules:[{required:!0,message:"\u914d\u7f6e\u6587\u4ef6\u4e0d\u80fd\u4e3a\u7a7a",trigger:"blur"}]})(c.a.createElement(g.h,{onChange:this.handleConfigChange,type:"textarea",rows:"50"})))))))}}]),t}(l.Component),Pe=g.f.create()(We),Be=n(142),Ge=n(327),$e=g.q.Option,Qe=g.f.Item,Xe={labelCol:{xs:{span:24},sm:{span:7}},wrapperCol:{xs:{span:24},sm:{span:10}}},Ze={labelCol:{xs:{span:24},sm:{span:7}},wrapperCol:{xs:{span:24},sm:{span:10}}},et=function(e){function t(e){var n;return Object(a.a)(this,t),(n=Object(i.a)(this,Object(s.a)(t).call(this,e))).submit=function(){ge.set("transforms",ye.a.values(n.state.transforms))},n.init=function(){var e=n.props.form,t=e.getFieldDecorator,a=e.setFieldsValue,r=e.resetFields;(function(e){return j.apply(this,arguments)})().then(function(e){if("L200"===e.code){var i=e.data;if(n.setState({options:i,currentOption:"\u8bf7\u9009\u62e9\u9700\u8981\u8f6c\u5316\u7684\u7c7b\u578b",items:e.data,currentItem:[]}),window.nodeCopy&&window.nodeCopy.transforms){var s={},o=[],l={},c="";s.spec=ye.a.reduce(ye.a.map(window.nodeCopy.transforms),function(e,a){a.key&&(c="(".concat(a.key,")"));var r=Object(pe.a)({},a,{type:"".concat(a.type).concat(c)});return e["uuid"+n.schemaUUID]=r,o.push("uuid"+n.schemaUUID),t("spec.".concat("uuid"+n.schemaUUID,".key"),{initialValue:a.key}),t("spec.".concat("uuid"+n.schemaUUID,".type"),{initialValue:"".concat(a.type).concat(c)}),t("spec.".concat("uuid"+n.schemaUUID,".stage"),{initialValue:a.stage}),ye.a.set(l,"uuid"+n.schemaUUID,a),n.schemaUUID++,e},{}),r(),a(s),n.setState({transforms:l,tags:o})}}}),function(e){return U.apply(this,arguments)}().then(function(e){"L200"===e.code&&n.setState({transformerTypes:e.data})})},n.copyTagConfig=function(e){var t=[];t[e]=!0,n.setState({isCopied:t})},n.onVisibleChange=function(e){var t=[];t[e]=!1,n.setState({isCopied:t})},n.renderTags=function(){var e=n.props.form,t=e.getFieldDecorator;e.getFieldValue;return n.state.tags.map(function(e,a){var r=n.state.transforms&&n.state.transforms[e];return c.a.createElement("div",{key:"spec.fields.".concat(e),style:{position:"relative"},className:"transformer-tag-container"},c.a.createElement(Qe,{style:{textAlign:"left"}},t("spec.".concat(e,".type"),{rules:[{required:!0,message:"\u5b57\u6bb5\u4e0d\u80fd\u4e3a\u7a7a"},{min:1,max:100,message:"\u957f\u5ea6\u5728 1 \u5230 100 \u4e2a\u5b57\u7b26"}]})(c.a.createElement(g.h,{disabled:!0,className:"transformer-tag"}))),n.state.isReadonly?null:c.a.createElement("span",null,c.a.createElement(g.g,{style:{marginTop:"23px"},className:"dynamic-delete-button",type:"edit",onClick:function(){return n.editTag(e)},title:"\u7f16\u8f91"}),c.a.createElement(g.n,{trigger:"click",content:JSON.stringify(r,null,"\t"),overlayStyle:{whiteSpace:"pre"}},c.a.createElement(g.g,{style:{marginTop:"23px"},className:"dynamic-delete-button",type:"eye-o",title:"\u67e5\u770b"})),c.a.createElement(Ge.CopyToClipboard,{onCopy:function(){return n.copyTagConfig(a)},text:JSON.stringify(r,null,"\t")},c.a.createElement(g.u,{visible:n.state.isCopied&&n.state.isCopied[a],title:"\u590d\u5236\u6210\u529f",onVisibleChange:function(){return n.onVisibleChange(a)}},c.a.createElement(g.g,{style:{marginTop:"23px"},className:"dynamic-delete-button",type:"copy",title:"\u590d\u5236"}))),c.a.createElement(g.m,{title:"\u662f\u5426\u5220\u9664\u8be5\u8f6c\u6362\u5668?",onConfirm:function(){return n.removeTag(e)}},c.a.createElement(g.g,{style:{marginTop:"23px"},className:"dynamic-delete-button",type:"delete",title:"\u5220\u9664"}))))})},n.renderFormItem=function(){var e=n.props.form,t=e.getFieldDecorator,a=e.getFieldValue,r=n.state.currentItem||[],i=[],s=[];return r.map(function(e,r){var o=null,l=-1!==e.Description.indexOf("(")?c.a.createElement("span",null,e.Description.slice(0,e.Description.indexOf("(")),c.a.createElement("br",null),c.a.createElement("span",{style:{color:"rgba(0,0,0,.43)",float:"right"}},e.Description.slice(e.Description.indexOf("("),e.Description.length))):c.a.createElement("span",null,e.Description),u=e.advance_depend&&a("".concat(n.state.currentOption,".").concat(e.advance_depend)),d="false"===u||!1===u;if(0==e.ChooseOnly?("name"==e.KeyName&&(e.Default="pandora.sender."+xe()().format("YYYYMMDDHHmmss")),o=c.a.createElement(Qe,Object.assign({key:r},Xe,{className:d?"hide-div":"show-div",label:l}),t("".concat(n.state.currentOption,".").concat(e.KeyName),{initialValue:e.Default,rules:[{required:e.required&&!d,message:"\u4e0d\u80fd\u4e3a\u7a7a",trigger:"blur"},{pattern:e.CheckRegex,message:"\u8f93\u5165\u4e0d\u7b26\u5408\u89c4\u8303"}]})("string"===e.Type?c.a.createElement(g.h,{placeholder:e.DefaultNoUse?e.placeholder:"\u7a7a\u503c\u53ef\u4f5c\u4e3a\u9ed8\u8ba4\u503c",disabled:n.state.isReadonly}):c.a.createElement(g.i,{placeholder:e.DefaultNoUse?e.placeholder:"\u7a7a\u503c\u53ef\u4f5c\u4e3a\u9ed8\u8ba4\u503c",disabled:n.state.isReadonly})))):o=c.a.createElement(Qe,Object.assign({key:r},Xe,{className:d?"hide-div":"show-div",label:l}),t("".concat(n.state.currentOption,".").concat(e.KeyName),{initialValue:e.Default||e.ChooseOptions[0]})(c.a.createElement(g.q,null,n.renderChooseOption(e.ChooseOptions)))),e&&e.advance)if(e.advance_depend){var m=n.getAdvancedConfig(e);m&&m.advance?s.push(o):n.state.advanceChecked&&i.push(o)}else s.push(o);else i.push(o)}),{result:i,advancedResults:s}},n.getAdvancedConfig=function(e){if(e.advance_depend)return n.state.currentItem.find(function(t){return t.KeyName===e.advance_depend})},n.handleChange=function(e){n.setState({currentOption:e,currentItem:"\u8bf7\u9009\u62e9\u9700\u8981\u8f6c\u5316\u7684\u7c7b\u578b"!=e?n.state.items[e]:[]})},n.renderSelectOptions=function(){var e=[];return e.push(c.a.createElement($e,{key:"\u8bf7\u9009\u62e9\u9700\u8981\u8f6c\u5316\u7684\u7c7b\u578b",value:"\u8bf7\u9009\u62e9\u9700\u8981\u8f6c\u5316\u7684\u7c7b\u578b"},"\u8bf7\u9009\u62e9\u9700\u8981\u8f6c\u5316\u7684\u7c7b\u578b(\u82e5\u65e0,\u76f4\u63a5\u5230\u4e0b\u4e00\u6b65)")),n.state.transformerTypes.map(function(t){e.push(c.a.createElement($e,{key:t.key,value:t.key},t.key+"  \uff08"+t.value+"\uff09"))}),e},n.renderChooseOption=function(e){var t=[];return e.map(function(e){var n=e;"boolean"===typeof n&&(n=String(n)),t.push(c.a.createElement($e,{key:e,value:e},n))}),t},n.addTag=function(){var e=n.props.form,t=e.getFieldsValue,a=e.getFieldDecorator,r=e.setFieldsValue,i=t(),s="";if("script"===n.state.currentOption&&i&&i[n.state.currentOption]&&i[n.state.currentOption].script&&(i[n.state.currentOption].script=window.btoa(encodeURIComponent(i[n.state.currentOption].script))),i[n.state.currentOption].key&&(s="(".concat(i[n.state.currentOption].key,")")),n.state.isEdit){r(Object(Be.a)({},"spec.".concat(n.state.editTag,".type"),"".concat(i[n.state.currentOption].type).concat(s)));var o=n.state.transforms,l=n.state.editTag;ye.a.set(o,l,i[n.state.currentOption]),n.setState({transforms:o,isEdit:!1},function(){n.handleChange("\u8bf7\u9009\u62e9\u9700\u8981\u8f6c\u5316\u7684\u7c7b\u578b")})}else if("\u8bf7\u9009\u62e9\u9700\u8981\u8f6c\u5316\u7684\u7c7b\u578b"!=n.state.currentOption){n.setState({tags:n.state.tags.concat("uuid".concat(n.schemaUUID))}),a("spec.".concat("uuid"+n.schemaUUID,".type"),{initialValue:"".concat(i[n.state.currentOption].type).concat(s),rules:[{required:!0,message:"\u6e90\u5b57\u6bb5\u4e0d\u80fd\u4e3a\u7a7a"},{min:1,max:100,message:"\u957f\u5ea6\u5728 1 \u5230 100 \u4e2a\u5b57\u7b26"}]});var c=n.state.transforms,u="uuid"+n.schemaUUID;ye.a.set(c,u,i[n.state.currentOption]),n.setState({transforms:c},function(){n.handleChange("\u8bf7\u9009\u62e9\u9700\u8981\u8f6c\u5316\u7684\u7c7b\u578b")}),n.schemaUUID++}else g.v.warning({message:"\u672a\u9009\u62e9\u5177\u4f53\u7c7b\u578b",description:"\u8bf7\u9009\u62e9\u9700\u8981\u8f6c\u5316\u7684\u7c7b\u578b\u518d\u6dfb\u52a0",duration:10})},n.editTag=function(e){n.setState({isEdit:!0,editTag:e});var t=n.props.form.setFieldsValue,a=n.state.transforms[e];n.handleChange(a&&a.type);var r={},i=a.type;for(var s in a)"type"!==s&&(r["".concat(i,".").concat(s)]=a[s]);setTimeout(function(){t(r)},0)},n.removeTag=function(e){n.setState({tags:n.state.tags.filter(function(t){return t!==e}),transforms:ye.a.omit(n.state.transforms,e),isEdit:!1},function(){n.handleChange("\u8bf7\u9009\u62e9\u9700\u8981\u8f6c\u5316\u7684\u7c7b\u578b")})},n.state={current:0,items:[],options:[],currentOption:"",currentItem:[],tags:[],transforms:{},transformerTypes:[],advanceChecked:!1,isEdit:!1,editTag:"",isViewTag:[]},n.schemaUUID=0,n}return Object(o.a)(t,e),Object(r.a)(t,[{key:"componentDidMount",value:function(){this.init()}},{key:"componentWillUnmount",value:function(){}},{key:"componentDidUpdate",value:function(e){this.submit()}},{key:"render",value:function(){var e=this,t=this.props.form.getFieldDecorator,n=this.renderFormItem();return c.a.createElement("div",null,c.a.createElement(g.f,{className:"slide-in text-color"},c.a.createElement(Qe,Object.assign({},Ze,{label:"\u9700\u8981\u8f6c\u5316\u5b57\u6bb5\u7684\u7c7b\u578b"}),t("".concat(this.state.currentOption,".type"),{initialValue:this.state.currentOption})(c.a.createElement(g.q,{onChange:this.handleChange},this.renderSelectOptions()))),c.a.createElement("div",{className:"ant-divider ant-divider-horizontal"}),n.result,n.advancedResults.length>0?c.a.createElement("div",null,c.a.createElement("div",{className:"ant-divider ant-divider-horizontal ant-divider-with-text"},c.a.createElement(g.c,{onChange:function(t){e.setState({advanceChecked:t.target.checked})},className:"ant-divider-inner-text"},"\u9ad8\u7ea7\u9009\u9879")),c.a.createElement("div",{className:this.state.advanceChecked?"show-div":"hide-div"},n.advancedResults)):null,c.a.createElement("div",{className:"option-add"},c.a.createElement(Qe,Object.assign({},Ze,{label:c.a.createElement("span",{style:{display:"none"}})}),c.a.createElement("div",{className:"option-add-btn"},c.a.createElement(g.b,{onClick:this.addTag,type:"primary",className:"option-add-tag-btn"},this.state.isEdit?"\u786e\u8ba4":"\u6dfb\u52a0")))),c.a.createElement("div",{className:this.state.tags.length>0?"render-tag-container":""},this.renderTags())))}}]),t}(l.Component),tt=g.f.create()(et);function nt(e){if("string"===typeof e)try{return JSON.parse(e),!0}catch(t){return!1}}var at=g.r.Step,rt=(g.j.Header,g.j.Content,g.j.Footer,g.j.Sider,[{title:"\u914d\u7f6e\u6570\u636e\u6e90",content:"\u914d\u7f6e\u76f8\u5173\u6570\u636e\u6e90\u4fe1\u606f"},{title:"\u914d\u7f6e\u89e3\u6790\u65b9\u5f0f",content:"\u914d\u7f6e\u76f8\u5173\u89e3\u6790\u65b9\u5f0f"},{title:"\u914d\u7f6eTransformer(\u975e\u5fc5\u586b)",content:"\u914d\u7f6e\u76f8\u5173\u5b57\u6bb5\u89e3\u6790"},{title:"\u914d\u7f6e\u53d1\u9001\u65b9\u5f0f",content:"\u914d\u7f6e\u76f8\u5173\u53d1\u9001\u65b9\u5f0f"},{title:"\u786e\u8ba4\u5e76\u6dfb\u52a0\u6536\u96c6\u5668",content:"\u786e\u8ba4\u5e76\u6dfb\u52a0\u6536\u96c6\u5668"}]),it=function(e){function t(e){var n;return Object(a.a)(this,t),(n=Object(i.a)(this,Object(s.a)(t).call(this,e))).init=function(){Object(fe.a)(n);!0===window.isCopy&&n.setState({isCpoyStatus:!0}),window.nodeCopy&&ge.delete("metric")},n.addRunner=function(e){var t=n.props,a=t.currentTagName,r=t.currentMachineUrl,i=n.props.handleTurnToRunner,s=Object(fe.a)(n).refs.initConfig,o=s.validateFields,l=(0,s.getFieldsValue)();o(null,{},function(t){if(t)g.v.warning({message:"\u8868\u5355\u6821\u9a8c\u672a\u901a\u8fc7,\u8bf7\u68c0\u67e5",duration:20});else if(nt(l.config)){var n=JSON.parse(l.config);e&&(n.name=e);var s=null!=a&&void 0!=a?a:"",o=null!=r&&void 0!=r?r:"";window.isCluster&&!0===window.isCluster?Y({name:n.name,tag:s,url:o,body:n}).then(function(e){e&&"L200"===e.code&&(g.v.success({message:"\u6536\u96c6\u5668\u6dfb\u52a0\u6210\u529f",duration:10}),i())}):R({name:n.name,body:n}).then(function(e){e&&"L200"===e.code&&(g.v.success({message:"\u6536\u96c6\u5668\u6dfb\u52a0\u6210\u529f",duration:10}),i())})}else g.v.warning({message:"\u4e0d\u662f\u4e00\u4e2a\u5408\u6cd5\u7684json\u5bf9\u8c61,\u8bf7\u68c0\u67e5",duration:20})})},n.handleConfirmSaveAs=function(){var e=n.state.runnerName;e?n.addRunner(e):n.setState({isRunnerNameEmpty:!0})},n.getMenu=function(){return c.a.createElement(g.k,{onClick:function(){return n.handleShowAsPopVisible(!0)}},c.a.createElement(g.k.Item,{key:"save"},"\u53e6\u5b58\u4e3a"))},n.handleShowAsPopVisible=function(e){n.setState({showSaveAsPop:e})},n.updateRunner=function(){var e=window.nodeCopy.tag,t=window.nodeCopy.machineUrl,a=n.props.handleTurnToRunner,r=Object(fe.a)(n).refs.initConfig,i=r.validateFields,s=(0,r.getFieldsValue)();i(null,{},function(n){if(n)g.v.warning({message:"\u8868\u5355\u6821\u9a8c\u672a\u901a\u8fc7,\u8bf7\u68c0\u67e5",duration:20});else if(nt(s.config)){var r=JSON.parse(s.config),i=null!=e&&void 0!=e?e:"",o=null!=t&&void 0!=t?t:"";window.isCluster&&!0===window.isCluster?W({name:r.name,tag:i,url:o,body:r}).then(function(e){e&&"L200"===e.code&&(g.v.success({message:"\u6536\u96c6\u5668\u4fee\u6539\u6210\u529f",duration:10}),a())}):V({name:r.name,body:r}).then(function(e){e&&"L200"===e.code&&(g.v.success({message:"\u6536\u96c6\u5668\u4fee\u6539\u6210\u529f",duration:10}),a())})}else g.v.warning({message:"\u4e0d\u662f\u4e00\u4e2a\u5408\u6cd5\u7684json\u5bf9\u8c61,\u8bf7\u68c0\u67e5",duration:20})})},n.handleRunnerNameChange=function(e){n.setState({runnerName:e.target.value,isRunnerNameEmpty:!1})},n.state={current:0,isCpoyStatus:!1,sourceConfigCheck:!1,version:"",runnerName:"",isRunnerNameEmpty:!1},window.clearInterval(window.statusInterval),n}return Object(o.a)(t,e),Object(r.a)(t,[{key:"componentDidMount",value:function(){this.init()}},{key:"componentWillUnmount",value:function(){}},{key:"componentDidUpdate",value:function(e){}},{key:"next",value:function(){var e=this,t=this;if(this.setState({sourceConfigCheck:!0}),0===this.state.current)t.refs.checkSourceData.validateFields(null,{},function(t){if(t)g.v.warning({message:"\u8868\u5355\u6821\u9a8c\u672a\u901a\u8fc7,\u8bf7\u68c0\u67e5",duration:20});else{var n=e.state.current+1;e.setState({current:n})}});else if(1===this.state.current)t.refs.checkParseData.validateFields(null,{},function(t){if(t)g.v.warning({message:"\u8868\u5355\u6821\u9a8c\u672a\u901a\u8fc7,\u8bf7\u68c0\u67e5",duration:20});else{var n=e.state.current+1;e.setState({current:n})}});else if(2===this.state.current){if(void 0==this.refs.initTransform.getFieldsValue()["\u8bf7\u9009\u62e9\u9700\u8981\u8f6c\u5316\u7684\u7c7b\u578b"])return void g.v.warning({message:"\u60a8\u5f53\u524d\u9009\u62e9\u7684transform\u672a\u6dfb\u52a0",description:"\u8bf7\u70b9\u51fb\u6dfb\u52a0\u6309\u94ae\u6dfb\u52a0",duration:10});var n=this.state.current+1;this.setState({current:n})}else 3===this.state.current&&t.refs.checkSenderData.validateFields(null,{},function(n){if(n)g.v.warning({message:"\u8868\u5355\u6821\u9a8c\u672a\u901a\u8fc7,\u8bf7\u68c0\u67e5",duration:20});else{var a=e.state.current+1;e.setState({current:a});var r="runner."+xe()().format("YYYYMMDDHHmmss"),i=t.refs.initConfig.getFieldValue("batch_interval"),s=t.refs.initConfig.getFieldValue("name"),o=t.refs.initConfig.getFieldValue("batch_size"),l=t.refs.initConfig.getFieldValue("extra_info");window.isCopy&&window.nodeCopy&&(r=window.nodeCopy.name);var c=ge.getNodeData();c&&"grok"===c.parser.type&&""!=c.parser.grok_custom_patterns&&void 0!=c.parser.grok_custom_patterns&&(c.parser.grok_custom_patterns=window.btoa(encodeURIComponent(c.parser.grok_custom_patterns))),window.isCopy&&window.nodeCopy&&(s=window.nodeCopy.name,i=window.nodeCopy.batch_interval,o=window.nodeCopy.batch_size,l=window.nodeCopy.extra_info);var u=Object(pe.a)({name:void 0!=s?s:r,batch_interval:void 0!=i?i:60,batch_size:void 0!=o?o:2097152,extra_info:void 0!=l&&"true"===l.toString()},ge.getNodeData());t.refs.initConfig.setFieldsValue({config:JSON.stringify(u,null,2)}),t.refs.initConfig.setFieldsValue({name:void 0!=s?s:r}),t.refs.initConfig.setFieldsValue({extra_info:void 0!=l?l.toString():"false"}),t.refs.initConfig.setFieldsValue({batch_interval:void 0!=i?i:60}),t.refs.initConfig.setFieldsValue({batch_size:void 0!=o?o:2097152})}})}},{key:"prev",value:function(){var e=this.state.current-1;this.setState({current:e})}},{key:"turnToIndex",value:function(){window.nodeCopy=ge.getNodeData(),this.props.router.push({pathname:"/"})}},{key:"render",value:function(){var e=this,t=this.state.current;return c.a.createElement("div",{className:"logkit-create-container"},c.a.createElement(g.r,{current:t},rt.map(function(e){return c.a.createElement(at,{key:e.title,title:e.title})})),c.a.createElement("div",{className:"steps-content"},c.a.createElement("div",{className:0===this.state.current?"show-div":"hide-div"},c.a.createElement(Ne,{ref:"checkSourceData"})),c.a.createElement("div",{className:1===this.state.current?"show-div":"hide-div"},c.a.createElement(Me,{ref:"checkParseData"})),c.a.createElement("div",{className:2===this.state.current?"show-div":"hide-div"},c.a.createElement(tt,{ref:"initTransform"})),c.a.createElement("div",{className:3===this.state.current?"show-div":"hide-div"},c.a.createElement(ze,{ref:"checkSenderData"})),c.a.createElement("div",{className:4===this.state.current?"show-div":"hide-div"},c.a.createElement(Pe,{ref:"initConfig",isMetric:!1}))),c.a.createElement("div",{className:"steps-action"},c.a.createElement("a",{style:{textDecoration:"underline",marginRight:15},onClick:function(t){t.preventDefault(),e.props.handleTurnToRunner()}},"\u53d6\u6d88"),this.state.current>0&&c.a.createElement(g.b,{onClick:function(){return e.prev()}},"\u4e0a\u4e00\u6b65"),this.state.current<rt.length-1&&c.a.createElement(g.b,{type:"primary",style:{marginLeft:8},onClick:function(){return e.next()}},"\u4e0b\u4e00\u6b65"),this.state.current===rt.length-1&&!1===this.state.isCpoyStatus&&c.a.createElement(g.b,{type:"primary",onClick:function(){return e.addRunner()},style:{marginLeft:8}},"\u786e\u8ba4\u5e76\u63d0\u4ea4"),this.state.current===rt.length-1&&!0===this.state.isCpoyStatus&&c.a.createElement(g.e,{overlay:this.getMenu()},c.a.createElement(g.b,{type:"primary",onClick:function(){return e.updateRunner()},style:{marginLeft:8}},"\u4fee\u6539\u5e76\u63d0\u4ea4",c.a.createElement(g.g,{type:"down"})))),c.a.createElement(g.l,{width:400,title:"\u53e6\u5b58\u4e3a\u6536\u96c6\u5668",visible:this.state.showSaveAsPop,onOk:this.handleConfirmSaveAs,onCancel:function(){e.handleShowAsPopVisible(!1)}},c.a.createElement("div",{className:"save-as-form"},c.a.createElement("div",{className:"save-as-form-item"},c.a.createElement("label",null,"\u540d\u79f0"),c.a.createElement(g.h,{onChange:this.handleRunnerNameChange,value:this.state.runnerName,className:this.state.isRunnerNameEmpty?"error-border":""})))))}}]),t}(l.Component),st={stopped:"\u5df2\u505c\u6b62",running:"\u8fd0\u884c\u4e2d"},ot=n(92),lt=g.f.Item,ct=g.q.Option,ut={labelCol:{span:7},wrapperCol:{span:17}},dt=function(e){function t(e){var n;return Object(a.a)(this,t),(n=Object(i.a)(this,Object(s.a)(t).call(this,e))).transformRunner=function(e){var t=[];return ye.a.forIn(e,function(e,n){var a=[];null!=e.configs&&ye.a.forIn(e.configs,function(t,r){ye.a.merge(t,{tag:e.tag,machineUrl:n}),a.push(t)}),t.push({machineUrl:n,configs:a,error:e.error,tag:e.tag})}),t},n.transformStatus=function(e){var t=[];return ye.a.forIn(e,function(e,n){var a=[];null!==e.status&&ye.a.forIn(e.status,function(t,r){ye.a.merge(t,{tag:e.tag,machineUrl:n}),a.push(t)}),t.push({machineUrl:n,runnerStatus:a,error:e.error,tag:e.tag})}),t},n.getStatus=function(e,t){var a=Object(fe.a)(n);a.setState({isGetStatus:!0}),window.isCluster&&!0===window.isCluster?function(e){return B.apply(this,arguments)}({tag:e||n.state.currentTag,machineUrl:t||n.state.currentUrl}).then(function(r){if("L200"===r.code){var i=r.data,s=n.transformRunner(i);a.setState({runners:s}),function(e){return G.apply(this,arguments)}({tag:e||n.state.currentTag,machineUrl:t||n.state.currentUrl}).then(function(e){"L200"===e.code&&a.setState({runnerStatus:n.transformStatus(e.data),isLoading:!1,isGetStatus:!1})})}}):function(e){return I.apply(this,arguments)}().then(function(e){"L200"===e.code&&(a.setState({runners:ye.a.values(e.data)}),function(e){return _.apply(this,arguments)}().then(function(e){"L200"===e.code&&a.setState({runnerStatus:ye.a.values(e.data),isLoading:!1,isGetStatus:!1})}))})},n.init=function(){var e=Object(fe.a)(n);e.getStatus(),void 0!==window.statusInterval&&"undefined"!==window.statusInterval&&window.clearInterval(window.statusInterval),window.statusInterval=setInterval(function(){!1===e.state.isGetStatus&&e.getStatus()},8e3)},n.deleteRunner=function(e){n.setState({isLoading:!0}),!0===window.isCluster?function(e){return ce.apply(this,arguments)}({name:e.name,tag:e.tag,url:e.machineUrl}).then(function(e){"L200"===e.code&&(g.v.success({message:"\u5220\u9664\u6210\u529f",duration:10}),n.getStatus())}):function(e){return K.apply(this,arguments)}({name:e.name}).then(function(e){"L200"===e.code&&(g.v.success({message:"\u5220\u9664\u6210\u529f",duration:10}),n.getStatus())})},n.isShow=function(e){n.setState({currentItem:e,isShow:!0})},n.showConfig=function(e){n.setState({currentItem:e,isShowConfig:!0})},n.handleResetConfig=function(e){n.setState({isLoading:!0}),!0===window.isCluster?function(e){return le.apply(this,arguments)}({name:e.name,tag:e.tag,url:e.machineUrl}).then(function(e){"L200"===e.code&&g.v.success({message:"\u91cd\u7f6e\u6210\u529f",duration:10}),n.getStatus()}):function(e){return J.apply(this,arguments)}({name:e.name}).then(function(e){"L200"===e.code&&g.v.success({message:"\u91cd\u7f6e\u6210\u529f",duration:10}),n.getStatus()})},n.handleErrorCancel=function(){n.setState({isShow:!1})},n.handleConfigCancel=function(){n.setState({isShowConfig:!1})},n.setMachine=function(e){n.setState({currentUrl:e}),n.getStatus("",e)},n.setTag=function(e){n.setState({currentTag:e}),n.getStatus(e,"")},n.copyConfig=function(e){var t=n.props,a=t.handleTurnToRunner,r=t.handleTurnToMetricRunner;window.nodeCopy=e,g.v.success({message:"\u4fee\u6539\u914d\u7f6e\u6587\u4ef6,",description:"\u6309\u6b65\u9aa4\u53bb\u4fee\u6539\u914d\u7f6e\u9875\u9762\u7684Runner\u4fe1\u606f",duration:10}),void 0===e.metric?a():r()},n.optRunner=function(e){n.setState({isLoading:!0}),"caret-right"===e.iconType?!0===window.isCluster?re({name:e.name,tag:e.tag,url:e.machineUrl}).then(function(t){"L200"===t.code&&(e.iconType="poweroff",g.v.success({message:"\u5f00\u542f\u6210\u529f",duration:10}),n.getStatus())}):function(e){return q.apply(this,arguments)}({name:e.name}).then(function(t){"L200"===t.code&&(e.iconType="poweroff",g.v.success({message:"\u5f00\u542f\u6210\u529f",duration:10}),n.getStatus())}):!0===window.isCluster?function(e){return oe.apply(this,arguments)}({name:e.name,tag:e.tag,url:e.machineUrl}).then(function(t){"L200"===t.code&&(e.iconType="caret-right",g.v.success({message:"\u5173\u95ed\u6210\u529f",duration:10}),n.getStatus())}):function(e){return A.apply(this,arguments)}({name:e.name}).then(function(t){"L200"===t.code&&(e.iconType="caret-right",g.v.success({message:"\u5173\u95ed\u6210\u529f",duration:10}),n.getStatus())})},n.renderArrow=function(e,t){return"up"==t?c.a.createElement("div",null,e,c.a.createElement(g.g,{style:{color:"#00a854"},type:"arrow-up"})):"down"==t?c.a.createElement("div",null,e,c.a.createElement(g.g,{style:{color:"#f04134"},type:"arrow-down"})):c.a.createElement("div",null,e,c.a.createElement(g.g,{style:{color:"#ffbf00"},type:"minus"}))},n.state={current:0,currentItem:"",status:[],runners:[],runnerStatus:[],machineUrl:"",tag:"",isLoading:!1,currentTag:"",currentUrl:"",data:[],isFiltered:!1,isGetStatus:!0},n}return Object(o.a)(t,e),Object(r.a)(t,[{key:"componentDidMount",value:function(){this.init()}},{key:"componentWillUnmount",value:function(){}},{key:"componentWillReceiveProps",value:function(e){this.getStatus()}},{key:"componentDidUpdate",value:function(e){}},{key:"renderRunnerList",value:function(){var e=this,t=this.props,n=t.handleAddRunner,a=t.handleAddMetricRunner,r=[],i=[],s=[],o=[];window.isCluster&&!0===window.isCluster?(this.state.runners.map(function(e){e.configs&&e.configs.length>0&&e.configs.map(function(e){r.push(e)}),ye.a.includes(s,e.tag)||s.push(e.tag)}),this.state.runnerStatus.map(function(e){e.runnerStatus&&e.runnerStatus.length>0&&e.runnerStatus.map(function(e){i.push(e)}),o.push(e.machineUrl)})):(r=this.state.runners,i=this.state.runnerStatus);var l=[{title:"\u540d\u79f0",dataIndex:"name",width:"10%"},{title:"\u96c6\u7fa4",dataIndex:"tag",width:"5%",className:!0===window.isCluster?"":"hide-div"},{title:"\u673a\u5668\u5730\u5740",dataIndex:"machineUrl",width:"10%",className:!0===window.isCluster?"":"hide-div"},{title:"\u4fee\u6539\u65f6\u95f4",dataIndex:"createTime",width:"10%"},{title:"\u8fd0\u884c\u72b6\u6001",dataIndex:"status",width:"5%"},{title:"\u8bfb\u53d6\u603b\u6761\u6570",dataIndex:"readDataCount",width:"5%"},{title:"\u8bfb\u53d6\u6761\u6570(\u6761/\u79d2)",dataIndex:"readerNumber",width:"6%",render:function(t,n){return e.renderArrow(t,n.readerTrend)}},{title:"\u8bfb\u53d6\u901f\u7387(KB/s)",dataIndex:"readerkbNumber",width:"6%",render:function(t,n){return e.renderArrow(t,n.readerkbTrend)}},{title:"\u53d1\u9001\u901f\u7387(\u6761/s)",dataIndex:"sendNumber",width:"6%",render:function(t,n){return e.renderArrow(t,n.sendTrend)}},{title:"\u89e3\u6790\u6210\u529f/\u603b (\u6761\u6570)",dataIndex:"parseSuccessOfTotal",width:"6%"},{title:"\u53d1\u9001\u6210\u529f/\u603b (\u6761\u6570)",dataIndex:"successOfTotal",width:"6%"},{title:"\u8def\u5f84",dataIndex:"path",width:"8%"},{title:"\u5f85\u8bfb\u53d6\u6570\u636e",dataIndex:"lag",render:function(e,t,n){return e?c.a.createElement("span",null,(e.size||0)+(e.sizeunit?" "+e.sizeunit:e.sizeunit)):null}},{title:"\u9519\u8bef\u65e5\u5fd7",dataIndex:"errorLog",width:"3%",render:function(t,n){return c.a.createElement("a",null,c.a.createElement("div",{className:"editable-row-operations"},c.a.createElement(g.g,{title:"\u67e5\u770b\u9519\u8bef\u65e5\u5fd7",style:{fontSize:16},type:"eye-o",onClick:function(){return e.isShow(n)}})))}},{title:"\u8be6\u7ec6\u914d\u7f6e",dataIndex:"config",width:"3%",render:function(t,n){return c.a.createElement("a",null,c.a.createElement("div",{className:"editable-row-operations"},c.a.createElement(g.g,{title:"\u67e5\u770b\u6536\u96c6\u5668\u914d\u7f6e",style:{fontSize:16},type:"eye-o",onClick:function(){return e.showConfig(n)}})))}},{title:"\u7f16\u8f91",key:"copy",dataIndex:"copy",width:"4%",render:function(t,n){return c.a.createElement("a",null,c.a.createElement("div",{className:"editable-row-operations"},c.a.createElement(g.g,{title:"\u7f16\u8f91Runner",style:{fontSize:16},onClick:function(){return e.copyConfig(n.currentItem)},type:"edit"})))}},{title:"\u64cd\u4f5c",key:"opt",dataIndex:"opt",width:"4%",render:function(t,n){return!0===n.isWebFolder?c.a.createElement("a",null,c.a.createElement("div",{className:"editable-row-operations"},c.a.createElement(g.m,{title:"\u662f\u5426"+n.runnerOpt+"\u8be5\u6536\u96c6\u5668?",onConfirm:function(){return e.optRunner(n)}},c.a.createElement(g.g,{title:n.runnerOpt+"\u6536\u96c6\u5668",style:{fontSize:16},type:n.iconType})))):null}},{title:"\u91cd\u7f6e",dataIndex:"reset",width:"4%",render:function(t,n){return!0===n.isWebFolder?c.a.createElement("a",null,c.a.createElement("div",{className:"editable-row-operations"},c.a.createElement(g.m,{title:"\u91cd\u7f6e\u914d\u7f6e\u6587\u4ef6\u4f1a\u5220\u9664meta\u4fe1\u606f\u5e76\u91cd\u542f,\u662f\u5426\u91cd\u7f6e\u8be5\u6536\u96c6\u5668?",onConfirm:function(){return e.handleResetConfig(n)}},c.a.createElement(g.g,{title:"\u91cd\u7f6e\u6536\u96c6\u5668",style:{fontSize:16},type:"reload"})))):null}},{title:"\u5220\u9664",key:"edit",dataIndex:"edit",width:"4%",render:function(t,n){return!0===n.isWebFolder?c.a.createElement("a",null,c.a.createElement("div",{className:"editable-row-operations"},c.a.createElement(g.m,{title:"\u662f\u5426\u5220\u9664\u8be5\u6536\u96c6\u5668?",onConfirm:function(){return e.deleteRunner(n)}},c.a.createElement(g.g,{title:"\u5220\u9664\u6536\u96c6\u5668",style:{fontSize:16},type:"delete"})))):null}}],u=[];return null!=r&&r.map(function(e){var t="",n="",a=0,r=0,s=0,o=0,l=0,c=0,d=0,m="",p=0,f=0,h=!1,g="",v="",y="",w="",b="stable",k="stable",E="stable",C="stable",O="poweroff",S="\u505c\u6b62",N="",T="",x={};e.is_stopped&&(t="\u5173\u95ed",S="\u91cd\u542f",O="caret-right",h=e.web_folder),i.map(function(i){e.name+e.machineUrl===i.name+i.url&&(t=st[i.runningStatus],N=e.tag,T=e.machineUrl,n=xe()(e.createtime).format("YYYY-MM-DD HH:mm:ss"),a=i.parserStats.success,r=i.parserStats.errors,s=void 0==ye.a.values(i.senderStats)[0]?0:ye.a.values(i.senderStats)[0].success,d=void 0==ye.a.values(i.senderStats)[0]?0:ye.a.values(i.senderStats)[0].errors,p=ye.a.floor(void 0==ye.a.values(i.senderStats)[0]?0:ye.a.values(i.senderStats)[0].speed,3),f=ye.a.floor(i.parserStats.speed,3),l=i.readDataCount,o=ye.a.floor(i.readspeed,3),c=ye.a.floor(i.readspeed_kb,3),b=void 0==ye.a.values(i.senderStats)[0]?"":ye.a.values(i.senderStats)[0].trend,k=i.parserStats.trend,E=i.readspeedtrend,C=i.readspeedtrend_kb,m=i.logpath,g=i.readerStats.last_error,v=i.parserStats.last_error,y=void 0==ye.a.values(i.senderStats)[0]?"":ye.a.values(i.senderStats)[0].last_error,h=e.web_folder,w=i.error,x=i.lag)}),u.push({key:ot(),name:e.name,tag:N,lag:x,machineUrl:T,createTime:n,status:t,sendNumber:p,parseNumber:f,readDataCount:l,readerNumber:o,readerkbNumber:c,readerTrend:E,readerkbTrend:C,sendTrend:b,parseTrend:k,parseSuccessOfTotal:a+"/"+(a+r),successOfTotal:s+"/"+(s+d),path:m,readerError:g,parseError:v,sendError:y,logkitError:w,copy:JSON.stringify(e,null,2),currentItem:e,iconType:O,runnerOpt:S,isWebFolder:h})}),c.a.createElement("div",null,!0===window.isCluster?c.a.createElement(g.f,{layout:"inline"},c.a.createElement(lt,Object.assign({},ut,{style:{width:"300px"},label:"\u96c6\u7fa4\u540d\u79f0"}),c.a.createElement(g.q,{className:"select-field",showSearch:!0,defaultValue:"",onChange:function(t){return e.setTag(t)}},c.a.createElement(ct,{key:"alltag",value:""},"\u5168\u90e8"),s.map(function(e,t){return c.a.createElement(ct,{key:e+t,value:e},e)}))),c.a.createElement(lt,Object.assign({},ut,{style:{width:"300px"},label:"\u673a\u5668\u5730\u5740"}),c.a.createElement(g.q,{className:"select-field",showSearch:!0,defaultValue:"",onChange:function(t){return e.setMachine(t)}},c.a.createElement(ct,{key:"allmachine",value:""},"\u5168\u90e8"),o.map(function(e,t){return c.a.createElement(ct,{key:e+t,value:e},e)})))):c.a.createElement("div",{style:{marginBottom:"15px"}},c.a.createElement(g.b,{type:"primary",style:{marginRight:"50px"},className:"index-btn",ghost:!0,onClick:n},c.a.createElement(g.g,{type:"plus"})," \u589e\u52a0\u65e5\u5fd7\u91c7\u96c6\u6536\u96c6\u5668"),c.a.createElement(g.b,{type:"primary",className:"index-btn",ghost:!0,onClick:a},c.a.createElement(g.g,{type:"plus"})," \u589e\u52a0\u7cfb\u7edf\u4fe1\u606f\u91c7\u96c6\u6536\u96c6\u5668"),c.a.createElement(g.h,{suffix:c.a.createElement(g.g,{type:"search",className:"certain-category-icon"}),onChange:function(t){e.setState({data:u.filter(function(e){return e.name.indexOf(t.target.value)>-1}),isFiltered:!0})},placeholder:"\u5728\u6b64\u8f93\u5165\u540d\u79f0",style:{width:200,float:"right"}})),this.state.isFiltered?c.a.createElement(g.s,{columns:l,pagination:{size:"small",pageSize:20},dataSource:this.state.data}):c.a.createElement(g.s,{columns:l,pagination:{size:"small",pageSize:20},dataSource:u}))}},{key:"render",value:function(){return c.a.createElement("div",null,this.renderRunnerList(),c.a.createElement(g.l,{footer:null,title:"\u9519\u8bef\u65e5\u5fd7",width:1e3,visible:this.state.isShow,onCancel:this.handleErrorCancel},c.a.createElement(g.t,{color:"#108ee9"},"\u8bfb\u53d6\u9519\u8bef\u65e5\u5fd7:"),c.a.createElement(g.p,{style:{marginTop:"10px"}},c.a.createElement(g.d,{span:24},this.state.currentItem.readerError)),c.a.createElement(g.t,{color:"#108ee9",style:{marginTop:"30px"}},"\u89e3\u6790\u9519\u8bef\u65e5\u5fd7:"),c.a.createElement(g.p,{style:{marginTop:"10px"}},c.a.createElement(g.d,{span:24},this.state.currentItem.parseError)),c.a.createElement(g.t,{color:"#108ee9",style:{marginTop:"30px"}},"\u53d1\u9001\u9519\u8bef\u65e5\u5fd7:"),c.a.createElement(g.p,{style:{marginTop:"10px"}},c.a.createElement(g.d,{span:24},this.state.currentItem.sendError)),c.a.createElement(g.t,{color:"#108ee9",style:{marginTop:"30px"}},"Logkit\u9519\u8bef\u65e5\u5fd7:"),c.a.createElement(g.p,{style:{marginTop:"10px"}},c.a.createElement(g.d,{span:24},this.state.currentItem.logkitError))),c.a.createElement(g.l,{footer:null,title:"\u8be6\u7ec6\u914d\u7f6e\u60c5\u51b5",width:1e3,visible:this.state.isShowConfig,onCancel:this.handleConfigCancel},c.a.createElement(g.h,{type:"textarea",value:this.state.currentItem.copy,rows:"50"})))}}]),t}(l.Component),mt=g.f.create()(dt),pt={rename:"\u662f\u5426\u4fee\u6539\u96c6\u7fa4\u540d\u79f0?",stop:"\u662f\u5426\u505c\u6b62\u8be5\u96c6\u7fa4\u4e0b\u540c\u540d\u7684\u4e00\u6279\u6536\u96c6\u5668\uff1f",start:"\u662f\u5426\u91cd\u542f\u8be5\u96c6\u7fa4\u4e0b\u540c\u540d\u7684\u4e00\u6279\u6536\u96c6\u5668\uff1f",delete:"\u662f\u5426\u5220\u9664\u8be5\u96c6\u7fa4\u4e0b\u540c\u540d\u7684\u4e00\u6279\u6536\u96c6\u5668\uff1f"},ft=g.f.Item,ht=(g.q.Option,function(e){function t(e){var n;return Object(a.a)(this,t),(n=Object(i.a)(this,Object(s.a)(t).call(this,e))).showTagModal=function(e,t){n.setState({currentTag:e,isShowTagModal:!0,currentModalType:t,currentModalTitle:pt[t]})},n.deleteSlave=function(e){ee({name:e.name,url:e.machineUrl}).then(function(e){"L200"===e.code&&(g.v.success({message:"\u5220\u9664\u6210\u529f",duration:10}),n.getClusterSLave())})},n.handleTagModal=function(){n.setState({isLoading:!0}),"rename"==n.state.currentModalType?X({name:n.state.currentTag.name,url:n.state.currentTag.machineUrl,body:{tag:n.state.currentTagName}}).then(function(e){"L200"===e.code&&(g.v.success({message:"\u91cd\u547d\u540d\u6210\u529f",duration:10}),n.setState({isShowTagModal:!1}),n.getClusterSLave())}):"delete"==n.state.currentModalType&&ee({tag:n.state.currentTag.name,url:n.state.currentTag.machineUrl}).then(function(e){"L200"===e.code&&(g.v.success({message:"\u5220\u9664\u6210\u529f",duration:10}),n.setState({isShowTagModal:!1}),n.getClusterSLave())})},n.handleTagModalCancel=function(){n.setState({isShowTagModal:!1})},n.changeTagName=function(e){n.setState({currentTagName:e.target.value})},n.getClusterSLave=function(){$().then(function(e){"L200"===e.code&&n.setState({machines:ye.a.values(e.data)})})},n.state={current:0,currentItem:"",status:[],machines:[],isShowTagModal:!1,currentTag:"",currentTagName:"",currentModalType:""},n}return Object(o.a)(t,e),Object(r.a)(t,[{key:"componentDidMount",value:function(){this.init()}},{key:"componentWillUnmount",value:function(){}},{key:"componentDidUpdate",value:function(e){}},{key:"init",value:function(){var e=this;this.getClusterSLave(),window.machineInterval=setInterval(function(){e.getClusterSLave()},15e3)}},{key:"renderMachineList",value:function(){var e=this,t=[],n=this.props,a=(n.machines,n.handleAddRunner),r=n.handleAddMetricRunner;this.state.machines.map(function(e){t.push({key:ot(),name:e.tag,machineUrl:e.url,status:e.status,last_touch:xe()(e.last_touch).format("YYYY-MM-DD HH:mm:ss")})});var i=[{title:"\u673a\u5668\u5730\u5740",dataIndex:"machineUrl",key:"machineUrl"},{title:"\u96c6\u7fa4\u540d\u79f0",dataIndex:"name",key:"name"},{title:"\u72b6\u6001",dataIndex:"status",key:"status"},{title:"\u5fc3\u8df3\u65f6\u95f4",dataIndex:"last_touch",key:"last_touch"},{title:"\u66f4\u6539\u96c6\u7fa4\u540d\u79f0",dataIndex:"rename",key:"rename",width:"10%",render:function(t,n){return c.a.createElement("a",null,c.a.createElement("div",{className:"editable-row-operations"},"ok"===n.status?c.a.createElement(g.g,{style:{fontSize:16},type:"setting",title:"\u96c6\u7fa4\u91cd\u547d\u540d",onClick:function(){return e.showTagModal(n,"rename")}}):null))}},{title:"\u6dfb\u52a0\u6536\u96c6\u5668",key:"edit",dataIndex:"edit",width:"10%",render:function(e,t){return c.a.createElement("a",null,c.a.createElement("div",{className:"editable-row-operations"},c.a.createElement(g.g,{title:"\u6dfb\u52a0\u6536\u96c6\u5668",onClick:function(){return a(t.machineUrl,"machine")},style:{fontSize:16},type:"plus-circle-o"})))}},{title:"\u6dfb\u52a0\u7cfb\u7edf\u4fe1\u606f\u6536\u96c6\u5668",key:"addMetricRunner",dataIndex:"addMetricRunner",width:"10%",render:function(e,t){return c.a.createElement("a",null,c.a.createElement("div",{className:"editable-row-operations"},c.a.createElement(g.g,{title:"\u6dfb\u52a0\u7cfb\u7edf\u4fe1\u606f\u6536\u96c6\u5668",onClick:function(){return r(t.machineUrl,"machine")},style:{fontSize:16},type:"plus-circle-o"})))}},{title:"\u5220\u9664",dataIndex:"delete",key:"delete",width:"6%",render:function(t,n){return c.a.createElement("a",null,c.a.createElement("div",{className:"editable-row-operations"},c.a.createElement(g.m,{title:"\u662f\u5426\u5220\u9664\u8be5\u673a\u5668?",onConfirm:function(){return e.deleteSlave(n)}},c.a.createElement(g.g,{title:"\u5220\u9664\u6536\u96c6\u5668",style:{fontSize:16},type:"delete"}))))}}];return c.a.createElement(g.s,{columns:i,pagination:{size:"small",pageSize:20},dataSource:t})}},{key:"render",value:function(){return c.a.createElement("div",null,this.renderMachineList(),c.a.createElement(g.l,{title:this.state.currentModalTitle,visible:this.state.isShowTagModal,onOk:this.handleTagModal,onCancel:this.handleTagModalCancel},c.a.createElement(ft,{label:"\u540d\u79f0"},c.a.createElement(g.h,{key:"rename",onChange:this.changeTagName,placeholder:"\u65b0\u96c6\u7fa4\u540d\u79f0"}))))}}]),t}(l.Component)),gt=g.f.create()(ht),vt=g.f.Item,yt=function(e){function t(e){var n;return Object(a.a)(this,t),(n=Object(i.a)(this,Object(s.a)(t).call(this,e))).submit=function(){n.props.handleMetricKeys(n.state.isChecked)},n.init=function(){(function(e){return T.apply(this,arguments)})().then(function(e){if("L200"===e.code){var t={};Object.keys(e.data).filter(function(e){return"success"!==e}).forEach(function(n){var a={};e.data[n].forEach(function(e){a[e.key]=!0}),t[n]=a}),window.nodeCopy&&window.nodeCopy.metric&&window.nodeCopy.metric.map(function(e){for(var n in e.attributes)t[e.type][n]=e.attributes[n]}),n.setState({items:e.data,isChecked:t}),n.initCheckAll()}})},n.initCheckAll=function(){var e={},t={},a=n.state.items;for(var r in n.state.isChecked){var i=0;for(var s in n.state.isChecked[r])n.state.isChecked[r][s]||i++;0===i?(e[r]=!0,t[r]=!1):i===a[r].length?(e[r]=!1,t[r]=!1):(e[r]=!1,t[r]=!0)}n.setState({checkAll:e,indeterminate:t})},n.onCheckboxChange=function(e,t){var a=n.state.isChecked;a[e][t]=!a[e][t],n.setState({isChecked:a}),n.initCheckAll()},n.onCheckAllChange=function(e){var t=n.state.checkAll,a=n.state.isChecked,r=n.state.indeterminate;if(t[e]){for(var i in a[e])a[e][i]=!1;r[e]=!1,t[e]=!1}else{for(var s in a[e])a[e][s]=!0;r[e]=!1,t[e]=!0}n.setState({checkAll:t,isChecked:a,indeterminate:r})},n.renderFormItem=function(){var e=[],t=n.state.isChecked,a=ge.get("metric");a||(a=[]);var r=n.props.form.getFieldDecorator;return a.map(function(a){var i=a.type,s=n.state.items[i];if(!s||s.length<=0)return!0;e.push(c.a.createElement(vt,{key:i},c.a.createElement("dis",null,c.a.createElement("span",null,c.a.createElement("b",null,i," \u5b57\u6bb5\u914d\u7f6e")),c.a.createElement("span",{style:{marginLeft:"26px"}},c.a.createElement(g.c,{key:i,indeterminate:n.state.indeterminate[i],onChange:function(){n.onCheckAllChange(i)},checked:n.state.checkAll[i]},"\u5168\u9009/\u5168\u4e0d\u9009")),c.a.createElement("hr",null)),c.a.createElement(g.p,{style:{textAlign:"left",paddingLeft:"26px"}},s.map(function(e){return r("".concat(i,".").concat(e.key),{valuePropName:"checked",initialValue:t[i][e.key]})(c.a.createElement(g.d,{span:12,key:e.key},c.a.createElement(g.c,{checked:t[i][e.key],onChange:function(){return n.onCheckboxChange(i,e.key)}},e.key+" ("+e.value+")")))}))))}),e},n.state={items:{},isChecked:{},indeterminate:{},checkAll:{}},n}return Object(o.a)(t,e),Object(r.a)(t,[{key:"componentDidMount",value:function(){this.init()}},{key:"componentWillUnmount",value:function(){}},{key:"componentDidUpdate",value:function(e){this.submit()}},{key:"render",value:function(){return c.a.createElement("div",null,c.a.createElement(g.f,{className:"slide-in text-color"},this.renderFormItem()))}}]),t}(l.Component),wt=g.f.create()(yt),bt=g.q.Option,kt=g.f.Item,Et={labelCol:{xs:{span:24},sm:{span:7}},wrapperCol:{xs:{span:24},sm:{span:10}}},Ct=function(e){function t(e){var n;return Object(a.a)(this,t),(n=Object(i.a)(this,Object(s.a)(t).call(this,e))).submit=function(){var e=n.props.form.getFieldsValue,t=n.state.items,a=e(),r={},i=function(e){r[e]={},t[e].map(function(t){if("bool"===t.Type)r[e][t.KeyName]="true"===a[e][t.KeyName];else if("array"===t.Type){var n=a[e][t.KeyName].split(/\s*,\s*/);r[e][t.KeyName]=[],n.map(function(n){n.length>0&&r[e][t.KeyName].push(n)})}else r[e][t.KeyName]=a[e][t.KeyName]})};for(var s in a)i(s);n.props.handleMetricConfigs(r)},n.init=function(){(function(e){return D.apply(this,arguments)})().then(function(e){if("L200"===e.code){var t=n.props.form.setFieldsValue;if(n.setState({items:e.data}),window.nodeCopy&&window.nodeCopy.metric){var a={};window.nodeCopy.metric.map(function(t){a[t.type]={},e.data[t.type].map(function(e){t.config&&void 0!==t.config[e.KeyName]&&("bool"===e.Type?a[t.type][e.KeyName]=t.config[e.KeyName].toString():"array"===e.Type?a[t.type][e.KeyName]=t.config[e.KeyName].join(","):a[t.type][e.KeyName]=t.config[e.KeyName])})}),t(a)}}})},n.renderFormItem=function(){var e=[],t=ge.get("metric");t||(t=[]);var a=n.props.form.getFieldDecorator;return t.map(function(t,r){var i=t.type,s=n.state.items[i];if(!s||s.length<=0)return!0;e.push(c.a.createElement(kt,{key:i},c.a.createElement("b",null,i," \u914d\u7f6e\u9879"),c.a.createElement("hr",null))),s.map(function(t,r){0==t.ChooseOnly?e.push(c.a.createElement(kt,Object.assign({key:t.KeyName},Et,{className:"",label:c.a.createElement("span",{className:t.DefaultNoUse?"warningTip":""},t.Description)}),a("".concat(i,".").concat(t.KeyName),{initialValue:t.Default,rules:[{required:""!=t.Default,message:"\u4e0d\u80fd\u4e3a\u7a7a",trigger:"blur"},{pattern:t.CheckRegex,message:"\u8f93\u5165\u4e0d\u7b26\u5408\u89c4\u8303"}]})(c.a.createElement(g.h,{placeholder:t.DefaultNoUse?t.Default:"\u7a7a\u503c\u53ef\u4f5c\u4e3a\u9ed8\u8ba4\u503c",disabled:n.state.isReadonly})))):e.push(c.a.createElement(kt,Object.assign({key:t.KeyName},Et,{className:"",label:t.Description}),a("".concat(i,".").concat(t.KeyName),{initialValue:t.ChooseOptions[0],rules:[{required:!0,message:"\u4e0d\u80fd\u4e3a\u7a7a",trigger:"blur"}]})(c.a.createElement(g.q,null,n.renderChooseOption(t.ChooseOptions)))))})}),e},n.renderChooseOption=function(e){var t=[];return e.map(function(e){t.push(c.a.createElement(bt,{key:e,value:e},e))}),t},n.state={items:{}},n}return Object(o.a)(t,e),Object(r.a)(t,[{key:"componentDidMount",value:function(){this.init()}},{key:"componentWillUnmount",value:function(){}},{key:"componentDidUpdate",value:function(e){this.submit()}},{key:"render",value:function(){return c.a.createElement("div",null,c.a.createElement(g.f,{className:"slide-in text-color"},this.renderFormItem()))}}]),t}(l.Component),Ot=g.f.create()(Ct),St=g.q.Option,Nt=g.f.Item,Tt={labelCol:{xs:{span:24},sm:{span:7}},wrapperCol:{xs:{span:24},sm:{span:10}}},xt=function(e){function t(e){var n;return Object(a.a)(this,t),(n=Object(i.a)(this,Object(s.a)(t).call(this,e))).init=function(){(function(e){return x.apply(this,arguments)})().then(function(e){if("L200"===e.code){var t=n.props.form.setFieldsValue;if(n.setState({items:e.data}),window.nodeCopy&&window.nodeCopy.metric){var a={};window.nodeCopy.metric.map(function(e,t){a[e.type]="true"}),e.data.map(function(e,t){void 0===a[e.KeyName]&&(a[e.KeyName]="false")}),t(a)}}})},n.submit=function(){var e=[],t=(0,n.props.form.getFieldsValue)();ye.a.forIn(t,function(t,n){"true"===t&&e.push({type:n})}),ge.set("metric",e)},n.renderFormItem=function(){var e=[],t=n.props.form.getFieldDecorator;return n.state.items.map(function(a,r){0==a.ChooseOnly?e.push(c.a.createElement(Nt,Object.assign({key:r,KeyName:a.KeyName},Tt,{className:"",label:c.a.createElement("span",{className:a.DefaultNoUse?"warningTip":""},a.Description)}),t("".concat(a.KeyName),{initialValue:a.Default,rules:[{required:""!=a.Default,message:"\u4e0d\u80fd\u4e3a\u7a7a",trigger:"blur"},{pattern:a.CheckRegex,message:"\u8f93\u5165\u4e0d\u7b26\u5408\u89c4\u8303"}]})(c.a.createElement(g.h,{placeholder:a.DefaultNoUse?a.Default:"\u7a7a\u503c\u53ef\u4f5c\u4e3a\u9ed8\u8ba4\u503c",disabled:n.state.isReadonly})))):e.push(c.a.createElement(Nt,Object.assign({key:r,KeyName:a.KeyName},Tt,{className:"",label:a.Description}),t("".concat(a.KeyName),{initialValue:a.ChooseOptions[0],rules:[{required:!0,message:"\u4e0d\u80fd\u4e3a\u7a7a",trigger:"blur"}]})(c.a.createElement(g.q,null,n.renderChooseOption(a.ChooseOptions)))))}),e},n.renderChooseOption=function(e){var t=[];return e.map(function(e){t.push(c.a.createElement(St,{key:e,value:e},e))}),t},n.state={items:[]},n}return Object(o.a)(t,e),Object(r.a)(t,[{key:"componentDidMount",value:function(){this.init()}},{key:"componentWillUnmount",value:function(){}},{key:"componentDidUpdate",value:function(e){this.submit()}},{key:"render",value:function(){return c.a.createElement("div",null,c.a.createElement(g.f,{className:"slide-in text-color"},this.renderFormItem()))}}]),t}(l.Component),Dt=g.f.create()(xt),It=g.r.Step,jt=[{title:"\u7cfb\u7edf\u4fe1\u606f\u9009\u62e9",content:"\u914d\u7f6e\u9700\u8981\u91c7\u96c6\u7684\u7cfb\u7edf\u4fe1\u606f\u7c7b\u578b"},{title:"\u914d\u7f6e\u6536\u96c6\u5b57\u6bb5",content:"\u914d\u7f6e\u9700\u8981\u6536\u96c6\u7684\u5b57\u6bb5"},{title:"\u914d\u7f6emetric",content:"\u914d\u7f6e\u76f8\u5173\u5b57\u6bb5\u89e3\u6790"},{title:"\u914d\u7f6e\u53d1\u9001\u65b9\u5f0f",content:"\u914d\u7f6e\u76f8\u5173\u53d1\u9001\u65b9\u5f0f"},{title:"\u786e\u8ba4\u5e76\u6dfb\u52a0\u6536\u96c6\u5668",content:"\u786e\u8ba4\u5e76\u6dfb\u52a0"}],Ut=function(e){function t(e){var n;return Object(a.a)(this,t),(n=Object(i.a)(this,Object(s.a)(t).call(this,e))).init=function(){Object(fe.a)(n);!0===window.isCopy&&n.setState({isCopyStatus:!0}),window.nodeCopy&&(ge.delete("reader"),ge.delete("parser"),ge.delete("transforms"))},n.handleMetricKeys=function(e){n.state.metricKeys=e},n.handleMetricConfigs=function(e){n.state.metricConfigs=e},n.setConfig=function(){var e=[],t=ge.get("metric");t&&(t.map(function(t,a){t.attributes=n.state.metricKeys[t.type],t.config=n.state.metricConfigs[t.type],e.push(t)}),ge.set("metric",e))},n.addRunner=function(e){var t=n.props,a=t.currentTagName,r=t.currentMachineUrl,i=n.props.handleTurnToRunner,s=Object(fe.a)(n).refs.initConfig,o=s.validateFields,l=(0,s.getFieldsValue)();o(null,{},function(t){if(t)g.v.warning({message:"\u8868\u5355\u6821\u9a8c\u672a\u901a\u8fc7,\u8bf7\u68c0\u67e5",duration:20});else if(nt(l.config)){var n=JSON.parse(l.config);e&&(n.name=e);var s=null!=a&&void 0!=a?a:"",o=null!=r&&void 0!=r?r:"";window.isCluster&&!0===window.isCluster?Y({name:n.name,tag:s,url:o,body:n}).then(function(e){e&&"L200"===e.code&&(g.v.success({message:"\u7cfb\u7edf\u4fe1\u606f\u6536\u96c6\u5668\u6dfb\u52a0\u6210\u529f",duration:10}),i())}):R({name:n.name,body:n}).then(function(e){e&&"L200"===e.code&&(g.v.success({message:"\u7cfb\u7edf\u4fe1\u606f\u6536\u96c6\u5668\u6dfb\u52a0\u6210\u529f",duration:10}),i())})}else g.v.warning({message:"\u4e0d\u662f\u4e00\u4e2a\u5408\u6cd5\u7684json\u5bf9\u8c61,\u8bf7\u68c0\u67e5",duration:20})})},n.handleConfirmSaveAs=function(){var e=n.state.runnerName;e?n.addRunner(e):n.setState({isRunnerNameEmpty:!0})},n.getMenu=function(){return c.a.createElement(g.k,{onClick:function(){return n.handleShowAsPopVisible(!0)}},c.a.createElement(g.k.Item,{key:"save"},"\u53e6\u5b58\u4e3a"))},n.handleShowAsPopVisible=function(e){n.setState({showSaveAsPop:e})},n.updateRunner=function(){var e=window.nodeCopy.tag,t=window.nodeCopy.machineUrl,a=n.props.handleTurnToRunner,r=Object(fe.a)(n).refs.initConfig,i=r.validateFields,s=(0,r.getFieldsValue)();i(null,{},function(n){if(n)g.v.warning({message:"\u8868\u5355\u6821\u9a8c\u672a\u901a\u8fc7,\u8bf7\u68c0\u67e5",duration:20});else if(nt(s.config)){var r=JSON.parse(s.config),i=null!=e&&void 0!=e?e:"",o=null!=t&&void 0!=t?t:"";window.isCluster&&!0===window.isCluster?W({name:r.name,tag:i,url:o,body:r}).then(function(e){e&&"L200"===e.code&&(g.v.success({message:"\u6536\u96c6\u5668\u4fee\u6539\u6210\u529f",duration:10}),a())}):V({name:r.name,body:r}).then(function(e){e&&"L200"===e.code&&(g.v.success({message:"\u6536\u96c6\u5668\u4fee\u6539\u6210\u529f",duration:10}),a())})}else g.v.warning({message:"\u4e0d\u662f\u4e00\u4e2a\u5408\u6cd5\u7684json\u5bf9\u8c61,\u8bf7\u68c0\u67e5",duration:20})})},n.handleRunnerNameChange=function(e){n.setState({runnerName:e.target.value,isRunnerNameEmpty:!1})},n.state={current:0,version:"",metricKeys:{},metricConfigs:{},isCopyStatus:!1},window.clearInterval(window.statusInterval),n}return Object(o.a)(t,e),Object(r.a)(t,[{key:"componentDidMount",value:function(){this.init()}},{key:"componentWillUnmount",value:function(){}},{key:"componentDidUpdate",value:function(e){}},{key:"next",value:function(){var e=this,t=this;if(0===this.state.current)if(ge.get("metric").length>0){var n=this.state.current+1;this.setState({current:n})}else g.v.warning({message:"\u8bf7\u81f3\u5c11\u91c7\u96c6\u4e00\u79cd\u7cfb\u7edf\u4fe1\u606f",duration:20});else if(1===this.state.current){var a=[];if(ge.get("metric").map(function(t){var n=!1;for(var r in e.state.metricKeys[t.type])if(e.state.metricKeys[t.type][r])return n=!0,!0;!n&&Object.keys(e.state.metricKeys[t.type]).length&&a.push(t.type)}),a.length<=0){var r=this.state.current+1;this.setState({current:r})}else g.v.warning({message:"\u8bf7\u81f3\u5c11\u4e3a"+a.join(", ")+"\u9009\u62e9\u4e00\u4e2a\u91c7\u96c6\u7684\u5b57\u6bb5",duration:20})}else if(2===this.state.current){var i=this.state.current+1;this.setState({current:i})}else 3===this.state.current&&t.refs.checkSenderData.validateFields(null,{},function(n){if(n)g.v.warning({message:"\u8868\u5355\u6821\u9a8c\u672a\u901a\u8fc7,\u8bf7\u68c0\u67e5",duration:20});else{var a=e.state.current+1;e.setState({current:a}),e.setConfig();var r="runner."+xe()().format("YYYYMMDDHHmmss"),i=t.refs.initConfig.getFieldValue("batch_interval"),s=t.refs.initConfig.getFieldValue("collect_interval"),o=t.refs.initConfig.getFieldValue("name"),l=t.refs.initConfig.getFieldValue("batch_size"),c=t.refs.initConfig.getFieldValue("extra_info");window.isCopy&&window.nodeCopy&&(o=window.nodeCopy.name,i=window.nodeCopy.batch_interval,s=window.nodeCopy.collect_interval,l=window.nodeCopy.batch_size,c=window.nodeCopy.extra_info);var u=Object(pe.a)({name:void 0!=o?o:r,batch_interval:void 0!=i?i:60,batch_size:void 0!=l?l:2097152,collect_interval:void 0!=s?s:3,extra_info:void 0!=c&&"true"===c.toString()},ge.getNodeData());t.refs.initConfig.setFieldsValue({config:JSON.stringify(u,null,2)}),t.refs.initConfig.setFieldsValue({name:void 0!=o?o:r}),t.refs.initConfig.setFieldsValue({batch_interval:void 0!=i?i:60}),t.refs.initConfig.setFieldsValue({batch_size:void 0!=l?l:2097152}),t.refs.initConfig.setFieldsValue({extra_info:void 0!=c?c.toString():"false"}),t.refs.initConfig.setFieldsValue({collect_interval:void 0!=s?s:3})}})}},{key:"prev",value:function(){var e=this.state.current-1;this.setState({current:e})}},{key:"turnToIndex",value:function(){window.nodeCopy=ge.getNodeData(),this.props.router.push({pathname:"/"})}},{key:"render",value:function(){var e=this,t=this.state.current;return c.a.createElement("div",{className:"logkit-create-container"},c.a.createElement(g.r,{current:t},jt.map(function(e){return c.a.createElement(It,{key:e.title,title:e.title})})),c.a.createElement("div",{className:"steps-content"},c.a.createElement("div",{className:0===this.state.current?"show-div":"hide-div"},c.a.createElement("div",null,c.a.createElement("p",{className:"show-div info"},"\u6839\u636e\u9700\u8981\u9009\u62e9\u9700\u8981\u91c7\u96c6\u7684\u7cfb\u7edf\u4fe1\u606f\u7c7b\u578b")),c.a.createElement(Dt,{ref:"checkUsages"})),c.a.createElement("div",{className:1===this.state.current?"show-div":"hide-div"},c.a.createElement("div",null,c.a.createElement("p",{className:"show-div info"},"\u9009\u62e9\u9700\u8981\u91c7\u96c6\u7684\u7cfb\u7edf\u4fe1\u606f\u7684\u5b57\u6bb5(\u67d0\u4e9bmetric\u53ef\u80fd\u65e0\u6cd5\u8bbe\u7f6e)")),c.a.createElement(wt,{handleMetricKeys:function(t){return e.handleMetricKeys(t)}})),c.a.createElement("div",{className:2===this.state.current?"show-div":"hide-div"},c.a.createElement("div",null,c.a.createElement("p",{className:"show-div info"},"\u8bbe\u7f6eMetric\u7684\u4e00\u4e9b\u914d\u7f6e\u9879(\u67d0\u4e9bmetric\u53ef\u80fd\u6ca1\u6709\u914d\u7f6e\u9879)")),c.a.createElement(Ot,{handleMetricConfigs:function(t){return e.handleMetricConfigs(t)}})),c.a.createElement("div",{className:3===this.state.current?"show-div":"hide-div"},c.a.createElement("div",null,c.a.createElement("p",{className:"show-div info"},"\u9ec4\u8272\u5b57\u4f53\u9009\u6846\u9700\u6839\u636e\u5b9e\u9645\u60c5\u51b5\u4fee\u6539\uff0c\u5176\u4ed6\u53ef\u4f5c\u4e3a\u9ed8\u8ba4\u503c")),c.a.createElement(ze,{isMetric:"true",ref:"checkSenderData"})),c.a.createElement("div",{className:4===this.state.current?"show-div":"hide-div"},c.a.createElement(Pe,{ref:"initConfig",isMetric:!0}))),c.a.createElement("div",{className:"steps-action"},c.a.createElement("a",{style:{textDecoration:"underline",marginRight:15},onClick:function(t){t.preventDefault(),e.props.handleTurnToRunner()}},"\u53d6\u6d88"),this.state.current>0&&c.a.createElement(g.b,{onClick:function(){return e.prev()}},"\u4e0a\u4e00\u6b65"),this.state.current<jt.length-1&&c.a.createElement(g.b,{type:"primary",style:{marginLeft:8},onClick:function(){return e.next()}},"\u4e0b\u4e00\u6b65"),this.state.current===jt.length-1&&!1===this.state.isCopyStatus&&c.a.createElement(g.b,{type:"primary",onClick:function(){return e.addRunner()},style:{marginLeft:8}},"\u786e\u8ba4\u5e76\u63d0\u4ea4"),this.state.current===jt.length-1&&!0===this.state.isCopyStatus&&c.a.createElement(g.e,{overlay:this.getMenu()},c.a.createElement(g.b,{type:"primary",onClick:function(){return e.updateRunner()},style:{marginLeft:8}},"\u4fee\u6539\u5e76\u63d0\u4ea4",c.a.createElement(g.g,{type:"down"})))),c.a.createElement(g.l,{width:400,title:"\u53e6\u5b58\u4e3a\u6536\u96c6\u5668",visible:this.state.showSaveAsPop,onOk:this.handleConfirmSaveAs,onCancel:function(){e.handleShowAsPopVisible(!1)}},c.a.createElement("div",{className:"save-as-form"},c.a.createElement("div",{className:"save-as-form-item"},c.a.createElement("label",null,"\u540d\u79f0"),c.a.createElement(g.h,{onChange:this.handleRunnerNameChange,value:this.state.runnerName,className:this.state.isRunnerNameEmpty?"error-border":""})))))}}]),t}(l.Component),_t=g.f.Item,Mt=g.q.Option,Rt=function(e){function t(e){var n;return Object(a.a)(this,t),(n=Object(i.a)(this,Object(s.a)(t).call(this,e))).getClusterSLave=function(){$().then(function(e){"L200"===e.code&&n.setState({tags:ye.a.values(e.data),isLoading:!1})})},n.getRunnersByTag=function(e){(function(e){return me.apply(this,arguments)})({tag:e.name,url:""}).then(function(e){"L200"===e.code&&n.setState({runners:e.data})})},n.showTagModal=function(e,t){"rename"!==t&&n.getRunnersByTag(e),n.setState({currentTag:e,isShowTagModal:!0,currentModalType:t,currentModalTitle:pt[t]})},n.showDeleteTag=function(e){n.setState({currentTag:e,isShowDeleteTag:!0})},n.handleTagModal=function(){if(n.setState({isLoading:!0}),"rename"==n.state.currentModalType)X({name:n.state.currentTag.name,url:"",body:{tag:n.state.currentTagName}}).then(function(e){"L200"===e.code&&(g.v.success({message:"\u91cd\u547d\u540d\u6210\u529f",duration:10}),n.setState({isShowTagModal:!1}),n.getClusterSLave())});else if("edit"==n.state.currentModalType){var e=n.props,t=e.handleTurnToRunner,a=e.handleTurnToMetricRunner;(function(e){return ue.apply(this,arguments)})({name:n.state.currentRunnerName,tag:n.state.currentTag.name,url:""}).then(function(e){if("L200"===e.code){var r=e.data;r.machineUrl="",r.tag=n.state.currentTag.name,window.nodeCopy=r,void 0===r.metric?t():a(),n.setState({isShowTagModal:!1})}})}else"stop"==n.state.currentModalType?function(e){return ne.apply(this,arguments)}({name:n.state.currentRunnerName,tag:n.state.currentTag.name,url:""}).then(function(e){"L200"===e.code&&(g.v.success({message:"\u5173\u95ed\u6210\u529f",duration:10}),n.setState({isShowTagModal:!1}),n.getClusterSLave())}):"start"==n.state.currentModalType?re({name:n.state.currentRunnerName,tag:n.state.currentTag.name,url:""}).then(function(e){"L200"===e.code&&(g.v.success({message:"\u91cd\u542f\u6210\u529f",duration:10}),n.setState({isShowTagModal:!1}),n.getClusterSLave())}):"delete"==n.state.currentModalType?function(e){return se.apply(this,arguments)}({name:n.state.currentRunnerName,tag:n.state.currentTag.name,url:""}).then(function(e){"L200"===e.code&&(g.v.success({message:"\u5220\u9664\u6210\u529f",duration:10}),n.setState({isShowTagModal:!1}),n.getClusterSLave())}):"reset"==n.state.currentModalType&&function(e){return ae.apply(this,arguments)}({name:n.state.currentRunnerName,tag:n.state.currentTag.name,url:""}).then(function(e){"L200"===e.code&&(g.v.success({message:"\u91cd\u7f6e\u6210\u529f",duration:10}),n.setState({isShowTagModal:!1}),n.getClusterSLave())})},n.handleDeleteTag=function(){n.setState({isLoading:!0}),ee({name:n.state.currentTag.name,url:""}).then(function(e){"L200"===e.code&&(g.v.success({message:"\u5220\u9664\u6210\u529f",duration:10}),n.setState({isShowDeleteTag:!1}),n.getClusterSLave())})},n.handleTagModalCancel=function(){n.setState({isShowTagModal:!1})},n.handleDeleteTagCancel=function(){n.setState({isShowDeleteTag:!1})},n.changeTagName=function(e){n.setState({currentTagName:e.target.value})},n.changeRunnerName=function(e){n.setState({currentRunnerName:e})},n.printString=function(e){var t="";return e.map(function(e,n){t+=e+"   "}),t},n.checkStatus=function(e){return ye.a.includes(e,"lost")?"lost":ye.a.includes(e,"bad")?"bad":"ok"},n.renderSelectOptions=function(e){var t=[];return void 0!=e&&e.map(function(e){t.push(c.a.createElement(Mt,{key:e,value:e},e))}),t},n.state={status:[],machines:[],runners:[],tags:[],isShowTagModal:!1,isShowDeleteTag:!1,currentTag:"",currentTagName:"",currentModalType:"",currentRunnerName:"",isLoading:!1},n}return Object(o.a)(t,e),Object(r.a)(t,[{key:"componentDidMount",value:function(){this.init()}},{key:"componentWillUnmount",value:function(){}},{key:"componentDidUpdate",value:function(e){}},{key:"init",value:function(){var e=this;this.getClusterSLave(),window.tagInterval=setInterval(function(){e.getClusterSLave()},15e3)}},{key:"renderTagList",value:function(){var e=this,t=[],n=this.props,a=n.handleAddRunner,r=n.handleAddMetricRunner,i=[];ye.a.sortBy(this.state.tags,"tag").map(function(e,n){ye.a.includes(i,e.tag)?(t[ye.a.findIndex(t,"name",e.tag)].machineUrl.push(e.url),t[ye.a.findIndex(t,"name",e.tag)].status.push(e.status)):(i.push(e.tag),t.push({key:ot(),name:e.tag,machineUrl:[e.url],status:[e.status]}))});var s=[{title:"\u96c6\u7fa4\u540d\u79f0",dataIndex:"name",key:"name",width:"10%"},{title:"\u673a\u5668\u5730\u5740",dataIndex:"machineUrl",key:"machineUrl",render:function(t,n){return c.a.createElement("div",{className:"editable-row-operations"},e.printString(n.machineUrl))}},{title:"\u72b6\u6001",dataIndex:"status",key:"status",render:function(t,n){return c.a.createElement("div",{className:"editable-row-operations"},e.checkStatus(n.status))}},{title:"\u66f4\u6539\u96c6\u7fa4\u540d\u79f0",dataIndex:"rename",key:"rename",width:"10%",render:function(t,n){return c.a.createElement("a",null,c.a.createElement("div",{className:"editable-row-operations"},"ok"===e.checkStatus(n.status)?c.a.createElement(g.g,{style:{fontSize:16},type:"setting",title:"\u96c6\u7fa4\u91cd\u547d\u540d",onClick:function(){return e.showTagModal(n,"rename")}}):null))}},{title:"\u65e5\u5fd7\u6536\u96c6\u5668",key:"addlogRunner",dataIndex:"addlogRunner",width:"10%",render:function(t,n){return c.a.createElement("a",null,c.a.createElement("div",{className:"editable-row-operations"},"ok"===e.checkStatus(n.status)?c.a.createElement(g.g,{title:"\u6dfb\u52a0\u65e5\u5fd7\u6536\u96c6\u5668",onClick:function(){return a(n.name,"tag")},style:{fontSize:16},type:"plus-circle-o"}):null))}},{title:"\u7cfb\u7edf\u4fe1\u606f\u6536\u96c6\u5668",key:"addMetricRunner",dataIndex:"addMetricRunner",width:"10%",render:function(t,n){return c.a.createElement("a",null,c.a.createElement("div",{className:"editable-row-operations"},"ok"===e.checkStatus(n.status)?c.a.createElement(g.g,{title:"\u6dfb\u52a0\u7cfb\u7edf\u4fe1\u606f\u6536\u96c6\u5668",onClick:function(){return r(n.name,"tag")},style:{fontSize:16},type:"plus-circle-o"}):null))}},{title:"\u7f16\u8f91",key:"edit",dataIndex:"edit",width:"6%",render:function(t,n){return c.a.createElement("a",null,c.a.createElement("div",{className:"editable-row-operations"},"ok"===e.checkStatus(n.status)?c.a.createElement(g.g,{onClick:function(){return e.showTagModal(n,"edit")},title:"\u7f16\u8f91\u8be5\u96c6\u7fa4\u5bf9\u5e94\u7684\u6536\u96c6\u5668",style:{fontSize:16},type:"edit"}):null))}},{title:"\u505c\u6b62",key:"stop",dataIndex:"stop",width:"6%",render:function(t,n){return c.a.createElement("a",null,c.a.createElement("div",{className:"editable-row-operations"},"ok"===e.checkStatus(n.status)?c.a.createElement(g.g,{onClick:function(){return e.showTagModal(n,"stop")},title:"\u505c\u6b62\u8be5\u96c6\u7fa4\u5bf9\u5e94\u7684\u6536\u96c6\u5668",style:{fontSize:16},type:"poweroff"}):null))}},{title:"\u91cd\u542f",key:"start",dataIndex:"start",width:"6%",render:function(t,n){return c.a.createElement("a",null,c.a.createElement("div",{className:"editable-row-operations"},"ok"===e.checkStatus(n.status)?c.a.createElement(g.g,{onClick:function(){return e.showTagModal(n,"start")},title:"\u91cd\u542f\u8be5\u96c6\u7fa4\u5bf9\u5e94\u7684\u6536\u96c6\u5668",style:{fontSize:16},type:"caret-right"}):null))}},{title:"\u91cd\u7f6e",key:"reset",dataIndex:"reset",width:"6%",render:function(t,n){return c.a.createElement("a",null,c.a.createElement("div",{className:"editable-row-operations"},"ok"===e.checkStatus(n.status)?c.a.createElement(g.g,{onClick:function(){return e.showTagModal(n,"reset")},title:"\u91cd\u7f6e\u8be5\u96c6\u7fa4\u5bf9\u5e94\u7684\u6536\u96c6\u5668",style:{fontSize:16},type:"reload"}):null))}},{title:"\u5220\u9664",dataIndex:"delete",key:"delete",width:"6%",render:function(t,n){return c.a.createElement("a",null,c.a.createElement("div",{className:"editable-row-operations"},"bad"!==e.checkStatus(n.status)?c.a.createElement(g.g,{onClick:function(){return e.showTagModal(n,"delete")},title:"\u5220\u9664\u8be5\u96c6\u7fa4\u5bf9\u5e94\u7684\u6536\u96c6\u5668",style:{fontSize:16},type:"delete"}):null))}}];return c.a.createElement(g.s,{columns:s,pagination:{size:"small",pageSize:20},dataSource:t,loading:this.state.isLoading})}},{key:"render",value:function(){return c.a.createElement("div",null,this.renderTagList(),c.a.createElement(g.l,{title:this.state.currentModalTitle,visible:this.state.isShowTagModal,onOk:this.handleTagModal,onCancel:this.handleTagModalCancel},c.a.createElement(_t,{label:"\u540d\u79f0"},"rename"===this.state.currentModalType?c.a.createElement(g.h,{key:"rename",onChange:this.changeTagName,placeholder:"\u65b0\u96c6\u7fa4\u540d\u79f0"}):c.a.createElement(g.q,{style:{width:"200px"},key:"opt",onChange:this.changeRunnerName,placeholder:"\u9009\u62e9\u8be5\u96c6\u7fa4\u4e0b\u7684\u4e00\u4e2a\u6536\u96c6\u5668"},this.renderSelectOptions(this.state.runners)))),c.a.createElement(g.l,{title:"\u662f\u5426\u5220\u9664\u8be5\u96c6\u7fa4\u4e0b\u6240\u6709\u7684\u673a\u5668",visible:this.state.isShowDeleteTag,onOk:this.handleDeleteTag,onCancel:this.handleDeleteTagCancel}))}}]),t}(l.Component),Ft=g.f.create()(Rt),Vt=g.j.Header,Lt=g.j.Content,Kt=g.j.Footer,zt=g.j.Sider,qt=function(e){function t(e){var n;return Object(a.a)(this,t),(n=Object(i.a)(this,Object(s.a)(t).call(this,e))).init=function(){(function(e){return z.apply(this,arguments)})().then(function(e){"L200"===e.code&&n.setState({version:e.data.version})}),function(e){return de.apply(this,arguments)}().then(function(e){"L200"===e.code&&(window.isCluster=e.data,n.setState({isCluster:e.data}))})},n.initInterval=function(){window.clearInterval(window.tagInterval),window.clearInterval(window.machineInterval),window.clearInterval(window.statusInterval)},n.addLogRunner=function(e,t){ge.setNodeData({}),"tag"===t?n.setState({currentMenu:"createLog",currentTagName:e,currentMachineUrl:""}):n.setState({currentMenu:"createLog",currentMachineUrl:e,currentTagName:""}),window.isCopy=!1,window.nodeCopy=null,n.initInterval()},n.turnToRunnerTab=function(){n.setState({currentMenu:"runner"})},n.addMetricRunner=function(e,t){ge.setNodeData({}),"tag"===t?n.setState({currentMenu:"createMetricLog",currentTagName:e,currentMachineUrl:""}):n.setState({currentMenu:"createMetricLog",currentMachineUrl:e,currentTagName:""}),window.isCopy=!1,window.nodeCopy=null,n.initInterval()},n.onCollapse=function(e){n.setState({collapsed:e})},n.TurnToLogRunner=function(){n.setState({currentMenu:"createLog"}),window.isCopy=!0,n.initInterval()},n.TurnToMetricRunner=function(){n.setState({currentMenu:"createMetricLog"}),window.isCopy=!0,n.initInterval()},n.changeMenu=function(e){n.setState({currentMenu:e.key}),"runner"===e.key?(window.clearInterval(window.tagInterval),window.clearInterval(window.machineInterval)):"tag"===e.key?(window.clearInterval(window.statusInterval),window.clearInterval(window.machineInterval)):"machine"===e.key&&(window.clearInterval(window.tagInterval),window.clearInterval(window.statusInterval))},n.state={runners:[],status:[],currentItem:"",version:"",collapsed:!1,currentMenu:"runner",machines:[],currentTagName:"",currentMachineUrl:"",isCluster:!1},n.init(),n}return Object(o.a)(t,e),Object(r.a)(t,[{key:"componentDidMount",value:function(){}},{key:"componentWillUnmount",value:function(){}},{key:"componentDidUpdate",value:function(e){}},{key:"turnToConfigPage",value:function(){this.props.router.push({pathname:"/index/create?copyConfig=true"})}},{key:"render",value:function(){return c.a.createElement(g.j,{style:{minHeight:"100vh"}},c.a.createElement(zt,{collapsible:!0,collapsed:this.state.collapsed,onCollapse:this.onCollapse},c.a.createElement("div",{className:"logo"},!1===this.state.collapsed?c.a.createElement("img",{style:{marginLeft:"15px"},src:"../../../static/logkitIcon.png"}):c.a.createElement("img",{src:"../../../static/favicon.ico"})),c.a.createElement(g.k,{theme:"dark",defaultSelectedKeys:["runner"],mode:"inline",onClick:this.changeMenu},!0===window.isCluster?c.a.createElement(g.k.Item,{key:"tag"},c.a.createElement(g.g,{type:"tags-o"}),c.a.createElement("span",null,"\u96c6\u7fa4\u7ba1\u7406")):null,!0===window.isCluster?c.a.createElement(g.k.Item,{key:"machine"},c.a.createElement(g.g,{type:"desktop"}),c.a.createElement("span",null,"\u673a\u5668\u7ba1\u7406")):null,c.a.createElement(g.k.Item,{key:"runner"},c.a.createElement(g.g,{type:"file"}),c.a.createElement("span",null,"\u6536\u96c6\u5668(runner)\u7ba1\u7406")))),c.a.createElement(g.j,null,c.a.createElement(Vt,{className:"header",style:{background:"#fff",padding:0}},"\u4e03\u725bLogkit\u76d1\u63a7\u4e2d\u5fc3",this.state.version,c.a.createElement("div",{style:{float:"right"}},c.a.createElement("a",{target:"_blank",href:"https://github.com/qiniu/logkit"},c.a.createElement(g.t,{color:"#108ee9"},c.a.createElement(g.g,{type:"github",style:{fontSize:12,color:"white"}}),"logkit")," "),c.a.createElement("a",{target:"_blank",href:"https://github.com/qiniu/logkit/wiki"},c.a.createElement(g.t,{color:"#108ee9"},c.a.createElement(g.g,{type:"question-circle-o",style:{fontSize:12,color:"white"}}),"\u5e2e\u52a9\u6587\u6863")," "),c.a.createElement("a",{target:"_blank",href:"https://qiniu.github.io/pandora-docs/#/"},c.a.createElement(g.t,{color:"#108ee9"},"Pandora\u4ea7\u54c1")))),"tag"===this.state.currentMenu?c.a.createElement(Lt,{style:{margin:"0 16px"}},c.a.createElement(g.a,{style:{margin:"16px 0"}},c.a.createElement(g.a.Item,null,"\u96c6\u7fa4\u7ba1\u7406\u5217\u8868")),c.a.createElement("div",{style:{padding:24,background:"#fff",minHeight:800}},c.a.createElement("div",{className:"content"},c.a.createElement(Ft,{handleAddRunner:this.addLogRunner.bind(this),handleAddMetricRunner:this.addMetricRunner.bind(this),handleTurnToRunner:this.TurnToLogRunner.bind(this),handleTurnToMetricRunner:this.TurnToMetricRunner.bind(this)})))):null,"machine"===this.state.currentMenu?c.a.createElement(Lt,{style:{margin:"0 16px"}},c.a.createElement(g.a,{style:{margin:"16px 0"}},c.a.createElement(g.a.Item,null,"\u673a\u5668\u7ba1\u7406\u5217\u8868")),c.a.createElement("div",{style:{padding:24,background:"#fff",minHeight:800}},c.a.createElement("div",{className:"content"},c.a.createElement(gt,{handleAddRunner:this.addLogRunner.bind(this),handleAddMetricRunner:this.addMetricRunner.bind(this)})))):null,"runner"===this.state.currentMenu?c.a.createElement(Lt,{style:{margin:"0 16px"}},c.a.createElement(g.a,{style:{margin:"16px 0"}},c.a.createElement(g.a.Item,null,"\u6536\u96c6\u5668(runner)\u7ba1\u7406\u5217\u8868")),c.a.createElement("div",{style:{padding:24,background:"#fff",minHeight:800}},c.a.createElement("div",{className:"content"},c.a.createElement(mt,{isCluster:this.state.isCluster,handleAddRunner:this.addLogRunner.bind(this),handleAddMetricRunner:this.addMetricRunner.bind(this),handleTurnToRunner:this.TurnToLogRunner.bind(this),handleTurnToMetricRunner:this.TurnToMetricRunner.bind(this)})))):null,"createLog"===this.state.currentMenu?c.a.createElement(Lt,{style:{margin:"0 16px"}},c.a.createElement(g.a,{style:{margin:"16px 0"}},c.a.createElement(g.a.Item,null,window.isCopy?"\u4fee\u6539\u65e5\u5fd7\u6536\u96c6\u5668":"\u521b\u5efa\u65e5\u5fd7\u6536\u96c6\u5668")),c.a.createElement("div",{style:{padding:24,background:"#fff",minHeight:800}},c.a.createElement("div",{className:"content"},c.a.createElement(it,{currentTagName:this.state.currentTagName,currentMachineUrl:this.state.currentMachineUrl,handleTurnToRunner:this.turnToRunnerTab.bind(this)})))):null,"createMetricLog"===this.state.currentMenu?c.a.createElement(Lt,{style:{margin:"0 16px"}},c.a.createElement(g.a,{style:{margin:"16px 0"}},c.a.createElement(g.a.Item,null,"\u521b\u5efa\u7cfb\u7edf\u4fe1\u606f\u6536\u96c6\u5668")),c.a.createElement("div",{style:{padding:24,background:"#fff",minHeight:800}},c.a.createElement("div",{className:"content"},c.a.createElement(Ut,{currentTagName:this.state.currentTagName,currentMachineUrl:this.state.currentMachineUrl,handleTurnToRunner:this.turnToRunnerTab.bind(this)})))):null,c.a.createElement(Kt,{style:{textAlign:"center"}},"\u4e03\u725blogkit\u76d1\u63a7\u4e2d\u5fc3 ",c.a.createElement(g.g,{type:"copyright"}),"2018 \u4e03\u725b\u4e91")))}}]),t}(l.Component);n.d(t,"Index",function(){return At});var At=function(e){function t(e){var n;return Object(a.a)(this,t),(n=Object(i.a)(this,Object(s.a)(t).call(this,e))).state={},n}return Object(o.a)(t,e),Object(r.a)(t,[{key:"componentWillMount",value:function(){}},{key:"componentDidMount",value:function(){}},{key:"componentDidUpdate",value:function(e){}},{key:"render",value:function(){}}]),t}(l.Component);d.a.render(c.a.createElement(m.b,{history:m.c},c.a.createElement(m.a,{path:"/",components:qt}),c.a.createElement(m.a,{path:"/index/create-log-runner",components:it}),c.a.createElement(m.a,{path:"/index/create-metric-runner",components:Ut})),document.getElementById("root"))}},[[328,1,2]]]);
  //# sourceMappingURL=main.146739ef.chunk.js.map