2019-12-25 19:44:26 +08:00
|
|
|
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([[8],{"6G7H":function(e,t,a){"use strict";a.r(t);var i=a("jehZ"),n=a.n(i),s=(a("2qtc"),a("kLXV")),r=(a("OaEy"),a("2fM7")),l=(a("5NDa"),a("5rEg")),c=(a("g9YV"),a("wCAj")),m=(a("/zsF"),a("PArb")),o=(a("BoS7"),a("Sdc0")),d=(a("+BJd"),a("mr32")),h=(a("Awhp"),a("KrTs")),p=(a("5Dmo"),a("3S7+")),u=(a("Pwec"),a("CtXQ")),v=a("p0pE"),b=a.n(v),E=a("q1tI"),g=a.n(E),f=a("Bl7J"),N=a("/MKj"),w=a("t3Un");class y extends g.a.Component{constructor(){super(...arguments),this.state={server:[],group:[],visible:!1,submit:{tls:0,rate:1,tags:[]},loading:!0},this.moveRow=((e,t)=>{console.log(e,t)})}componentDidMount(){this.fetchData()}fetchData(){Object(w["a"])("/admin/server/fetch",{group_id:this.props.location.query.group_id}).then(e=>{200===e.code&&this.setState({server:e.data,loading:!1})}),Object(w["a"])("/admin/server/group/fetch").then(e=>{200===e.code&&this.setState({group:e.data})})}modalVisible(){this.setState({visible:!this.state.visible}),this.state.visible&&this.setState({submit:{tls:0,rate:1}})}submit(){Object(w["b"])("/admin/server/save",this.state.submit).then(e=>{200===e.code&&(this.modalVisible(),this.fetchData())})}drop(e){Object(w["b"])("/admin/server/drop",{id:e}).then(e=>{this.fetchData()})}update(e,t,a){this.setState({[e+t+"_loading"]:!0},()=>{Object(w["b"])("/admin/server/update",{id:e,[t]:a}).then(a=>{200===a.code&&(this.fetchData(),this.setState({[e+t+"_loading"]:!1}))})})}edit(e){this.setState({submit:b()({},this.state.server[e]),visible:!0})}render(){var e=[{title:"\u8282\u70b9ID",dataIndex:"id",key:"id"},{title:g.a.createElement("span",null,"\u5728\u7ebf ",g.a.createElement(p["a"],{placement:"top",title:"\u4e94\u5206\u949f\u5185\u8282\u70b9\u5728\u7ebf\u60c5\u51b5"},g.a.createElement(u["a"],{type:"question-circle"}))),dataIndex:"last_check_at",key:"last_check_at",align:"center",render:e=>{return g.a.createElement(h["a"],{status:(new Date).getTime()/1e3-300>e?"error":"processing"})}},{title:"\u6743\u9650\u7ec4",dataIndex:"group_id",key:"group_id",render:(e,t)=>{var a=t.group_id,i=[];return a.map(e=>{this.state.group.map(t=>{if(t.id===parseInt(e))return i.push(g.a.createElement(d["a"],null,t.name))})}),i}},{title:"\u8282\u70b9\u540d\u79f0",dataIndex:"name",key:"name"},{title:"\u5730\u5740",dataIndex:"host",key:"host",render:(e,t)=>{return t.host+":"+t.port}},{title:"TLS",dataIndex:"tls",key:"tls",render:e=>{return 0===e?"\u4e0d\u652f\u6301":"\u652f\u6301"}},{title:g.a.createElement(p["a"],{placement:"top",title:"\u4f7f\u7528\u7684\u6d41\u91cf\u5c06\u4e58\u4ee5\u500d\u7387\u8fdb\u884c\u6263\u9664"},"\u500d\u7387 ",g.a.createElement(u["a"],{type:"question-circle"})),dataIndex:"rate",key:"rate",align:"center",render:e=>{return g.a.createElement(d["a"],{color:"blue",style:{minWidth:60}},e+" x")}},{title:"\u663e\u9690",dataIndex:"show",key:"show",align:"center",render:(e,t)=>{return g.a.createElement(o["a"],{loading:this.state[t.id+"show_loading"],size:"small",checked:parseInt(e),onClick:()=>this.update(t.id,"show",parseInt(e)?0:1)})}},{title:"\u64cd\u4f5c",dataIndex:"action",key:"action",align:"right",render:(e,t,a)=>{return g.a.createElement("div",null,g.a.createElement("a",{href:"javascript:;",onClick:()=>this.edit(a)},"\u7f16\u8f91"),g.a.createElement(m["a"],{type:"vertical"}),g.a.createElement("a",{href:"javascript:;",onClick:()=>this.drop(t.id)},"\u5220\u9664"))}}];return g.a.createElement(f["a"],n()({},this.props,{loading:this.state.loading}),g.a.createElement("main",{id:"main-container"},g.a.createElement("div",{className:"content content-full"},g.a.createElement("div",{className:"d-flex justify-content-between align-items-center"},g.a.createElement("h2",{className:"font-w300 mt-4 mb-3"},"\u8282\u70b9\u7ba1\u7406"),g.a.createElement("button",{type:"button",className:"btn btn-primary btn-sm btn-primary btn-rounded px-3",onClick:()=>this.modalVisible()},"\u6dfb\u52a0\u8282\u70b9")),g.a.createElement("div",{className:"bg-white"},g.a.createElement(c["a"],{dataSource:this.state.server,columns:e,pagination:!1,scroll:{x:1e3},onRow:(e,t)=>({index:t,moveRow:this.moveR
|