webpackJsonp([31],{Ll7Y:function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=a("mtWM"),s=a.n(n),i={data:function(){return{url:"",percentage:0,state:0,output:"",estimatedDuration:0,startTime:0,auth:{username:"admin",password:"3edc#EDC"}}},computed:{height:function(){return window.innerHeight-100+"px"}},methods:{deploy:function(){var t=this;this.$confirm("确定重新部署?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(function(){return s.a.post("http://121.43.171.110:8000/job/信牧基础平台/build",null,{auth:t.auth})}).then(function(e){if(201===e.status)return t.startTime=(new Date).getTime(),s.a.get(e.headers.location+"api/json",{auth:t.auth});throw""}).then(function(e){t.url=e.data.executable.url,t.percentage=0,t.output="",t.state=1,t.pollingStatus()}).catch(function(t){})},pollingStatus:function(){var t=this;s.a.get(this.url+"api/json",{auth:this.auth}).then(function(e){if(200===e.status)if(e.data.building){t.estimatedDuration||(t.estimatedDuration=e.data.estimatedDuration+8e4);var a=100*((new Date).getTime()-t.startTime)/t.estimatedDuration;a=a<0?0:a>=100?99:parseInt(a),t.percentage=a,setTimeout(function(){t.pollingStatus()},1e3)}else{t.state=2;var n=setInterval(function(){var e=100*((new Date).getTime()-t.startTime)/t.estimatedDuration;e=e<0?0:e>=100?99:parseInt(e),t.percentage=e,s.a.get("http://121.43.171.110:8080/admin",{timeout:2e3}).then(function(e){console.log(e),t.state=3,t.percentage=100,t.$message.success("部署成功"),t.$alert("请刷新页面","部署成功",{type:"success",confirmButtonText:"立即刷新"}).then(function(){location.reload()}).catch(function(){}),clearInterval(n)}).catch(function(t){})},2100)}}),s.a.get(this.url+"/logText/progressiveText?start=0",{auth:this.auth}).then(function(e){200===e.status&&(t.output=e.data,setTimeout(function(){t.$refs.output.scrollTop=t.$refs.output.scrollHeight},100))})}}},o={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"container",style:{height:t.height}},[0===t.state?a("el-alert",{attrs:{title:"请谨慎操作",type:"warning",description:"重新部署会导致网站暂时无法访问",closable:!1,"show-icon":""}}):t._e(),t._v(" "),0===t.state?a("div",{staticStyle:{"margin-top":"20px"}},[a("el-button",{attrs:{size:"small",type:"danger",plain:""},on:{click:t.deploy}},[t._v("重新部署")])],1):t._e(),t._v(" "),1===t.state?a("el-alert",{attrs:{closable:!1,title:"部署中-编译代码",description:"部署过程中请不要进行其他操作",type:"info","show-icon":""}}):t._e(),t._v(" "),2===t.state?a("el-alert",{attrs:{closable:!1,title:"部署中-重启tomcat",description:"部署过程中请不要进行其他操作",type:"info","show-icon":""}}):t._e(),t._v(" "),3===t.state?a("el-alert",{attrs:{closable:!1,title:"部署成功",type:"success","show-icon":""}}):t._e(),t._v(" "),0!==t.state?a("el-progress",{attrs:{percentage:t.percentage}}):t._e(),t._v(" "),0!==t.state?a("pre",{ref:"output",staticClass:"output"},[t._v(t._s(t.output))]):t._e()],1)},staticRenderFns:[]};var r=a("VU/8")(i,o,!1,function(t){a("rut8")},"data-v-4b7e1820",null);e.default=r.exports},rut8:function(t,e){}});
//# sourceMappingURL=31.2d06ceadcf9d5b6b0eb6.js.map