PyTorchBoot/PytorchBoot/ui/client/static/js/app.230235873e25a72eeacb.js
2024-09-13 16:58:34 +08:00

2 lines
19 KiB
JavaScript

webpackJsonp([1],{0:function(t,e){},1:function(t,e){},2:function(t,e){},"4KX4":function(t,e){},"7QVd":function(t,e){},NHnr:function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=s("7+uW"),n={render:function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"app"},[e("router-view")],1)},staticRenderFns:[]},r=s("VU/8")({name:"App"},n,!1,null,null,null).exports,a=s("/ocq"),i=s("b3L9"),c=s.n(i),l=(s("7QVd"),{render:function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"page404"},[e("div",{staticClass:"content"},[e("h1",[this._v("404")]),this._v(" "),e("p",[this._v("Oops! The page you're looking for doesn't exist.")]),this._v(" "),e("router-link",{staticClass:"home-link",attrs:{to:"/"}},[this._v("Go Back Home")])],1)])},staticRenderFns:[]});var u=s("VU/8")({name:"Page404"},l,!1,function(t){s("4KX4")},"data-v-406aa924",null).exports,p=s("fZjL"),_=s.n(p),d=s("pFYg"),g=s.n(d),v=s("XLwt"),m=(s("OWql"),s("XReE"));v.a([m.a]);var f={name:"Dashboard",components:{},watch:{selected_config:{handler:function(t,e){this.config_data=this.convertToTree(this.configs[t]),this.config_data=Array.isArray(this.config_data)?this.config_data:[this.config_data]},immediate:!0}},computed:{},data:function(){return{root_path:"",running_apps:[],show_app_panel:!1,components:{},comments:{},applications:{},configs:{},selected_config:"",config_data:[],curr_status:{},last_status:{},progress:{},logs:[],cpu:{},memory:{},gpus:{}}},mounted:function(){console.log("mounted"),this.get_project_structure(),this.startStatusCheck()},methods:{get_progress_color:function(t){return t<50?"green":t<70?"orange":"red"},convertToTree:function(t){var e=this;return"object"!==(void 0===t?"undefined":g()(t))||null===t?t:_()(t).map(function(s){var o={title:s},n=e.convertToTree(t[s]);return n&&Array.isArray(n)?(o.children=n,o.expand=!0):null!==n&&(o.title=o.title+" : "+String(n)),o})},get_project_structure:function(){var t=this;this.$ajax.postjson("/project/structure",{}).then(function(e){t.root_path=e.root_path,t.components=e.components,t.comments=e.comments,t.applications=e.applications,t.configs=e.configs,t.selected_config=_()(t.configs)[0]})},run_app:function(t){var e=this,s={app_name:t};this.$ajax.postjson("/project/run_app",s).then(function(t){"success"==t.status?(e.$Message.success(t.message),e.startStatusCheck()):e.$Message.error(t.message)})},get_status:function(){var t=this;this.last_status=this.curr_status,this.$ajax.postjson("/project/get_status",{}).then(function(e){t.curr_status=e.curr_status,t.logs=e.logs,t.progress=e.progress,t.running_apps=e.running_apps,t.cpu=e.cpu,t.memory=e.memory,t.gpus=e.gpus,console.log("cpu-----------------",t.cpu),t.logs.length>0&&(t.show_app_panel=!0)})},startStatusCheck:function(){var t=this;this.stopStatusCheck(),this.statusInterval=setInterval(function(){t.get_status()},1e3)},stopStatusCheck:function(){this.statusInterval&&(clearInterval(this.statusInterval),this.statusInterval=null)},isAllProgressFull:function(t,e){var s=this.progress[t][e];return _()(s).every(function(t){return s[t][0]===s[t][1]})}}},h={render:function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticStyle:{padding:"20px"}},[t._m(0),t._v(" "),s("Divider"),t._v(" "),s("Row",{staticStyle:{"margin-top":"20px"}},[s("Col",{attrs:{span:"11"}},[s("Card",{ref:"logContainer",staticStyle:{width:"100%","margin-bottom":"10px"}},[s("p",{staticStyle:{"font-size":"18px","font-weight":"bold",color:"#464c5b"},attrs:{slot:"title"},slot:"title"},[s("Icon",{staticStyle:{color:"#464c5b"},attrs:{type:"ios-list",size:"20"}}),t._v("\n Logs\n ")],1),t._v(" "),s("div",{staticStyle:{"overflow-y":"auto","max-height":"200px"}},t._l(t.logs.slice().reverse(),function(e,o){return s("div",{key:o},[s("Alert",{attrs:{type:e[1],"show-icon":""}},[s("span",{staticStyle:{"font-weight":"bold"}},[t._v("("+t._s(e[0])+") ")]),t._v(t._s(e[2]))])],1)}),0)]),t._v(" "),s("Card",{staticStyle:{width:"100%"}},[s("p",{staticStyle:{"font-size":"18px","font-weight":"bold",color:"#464c5b"},attrs:{slot:"title"},slot:"title"},[s("Icon",{staticStyle:{color:"#464c5b"},attrs:{type:"ios-apps",size:"20"}}),t._v("\n Project Structure\n ")],1),t._v(" "),s("CellGroup",[s("p",{staticStyle:{"font-size":"17px",color:"#464c5b","padding-bottom":"5px","font-weight":"bold"}},[t._v("Applications")]),t._v(" "),t._l(Object.keys(t.applications),function(e){return s("Cell",{key:e},[s("Badge",{attrs:{status:"success"}}),t._v(" "),s("span",{staticStyle:{"padding-bottom":"3px","font-size":"13px","font-weight":"bold"}},[t._v(t._s(e))]),t._v(": \n "),s("Tag",{attrs:{type:"border",color:"success"}},[t._v(" "+t._s(t.applications[e])+" ")]),t._v(" "),s("Button",{attrs:{slot:"extra",type:"success",size:"small",disabled:t.running_apps.includes(e)},on:{click:function(s){return t.run_app(e)}},slot:"extra"},[s("Icon",{staticStyle:{"margin-right":"3px"},attrs:{type:"ios-play"}}),t._v("Run\n ")],1),t._v(" "),t.running_apps.includes(e)?s("span",[s("Icon",{staticClass:"demo-spin-icon-load",attrs:{type:"ios-loading",size:"18"}}),t._v(" Running...\n ")],1):t._e()],1)})],2),t._v(" "),s("Divider"),t._v(" "),s("CellGroup",[s("p",{staticStyle:{"font-size":"17px",color:"#464c5b","padding-bottom":"5px","font-weight":"bold"}},[t._v("Components")]),t._v(" "),t._l(Object.keys(t.components),function(e){return s("div",{key:e},[Object.keys(t.components[e]).length>0?s("div",[s("Tag",{staticStyle:{"font-size":"14px"}},[t._v(t._s(e))]),t._v(" "),t._l(Object.keys(t.components[e]),function(o){return s("Cell",{key:o},[s("Badge",{attrs:{status:null!=t.comments[e][o]?"warning":"success"}}),t._v(" "),s("span",{staticStyle:{"padding-bottom":"3px","font-size":"13px","font-weight":"bold"}},[t._v(t._s(o))]),t._v(": \n "),s("Tag",{attrs:{type:"border",color:null!=t.comments[e][o]?"warning":"success"}},[t._v(" "+t._s(t.components[e][o])+" ")]),t._v(" "),null!=t.comments[e][o]?s("Tag",{attrs:{slot:"extra",color:"red"},slot:"extra"},[t._v(t._s(t.comments[e][o]))]):t._e()],1)})],2):t._e()])})],2)],1)],1),t._v(" "),s("Col",{attrs:{span:"11",offset:"1"}},[s("Card",{staticStyle:{width:"100%","margin-bottom":"10px"}},[s("p",{staticStyle:{"font-size":"18px","font-weight":"bold",color:"#464c5b"},attrs:{slot:"title"},slot:"title"},[s("Icon",{staticStyle:{color:"#464c5b"},attrs:{type:"md-laptop",size:"20"}}),t._v("\n Machine Status\n ")],1),t._v(" "),s("Row",[s("span",{staticStyle:{"font-weight":"bold"}},[t._v("Project CPU Usage\n ("),s("span",{style:{color:t.get_progress_color(t.cpu.usage_percent)}},[t._v(t._s(t.cpu.usage_percent)+"%")]),t._v(")\n ")]),t._v(" "),s("Progress",{attrs:{percent:t.cpu.usage_percent,"stroke-color":t.get_progress_color(t.cpu.usage_percent)}})],1),t._v(" "),s("Row",[s("p",{staticStyle:{"font-weight":"bold"}},[t._v("\n Memory \n ("),s("span",{style:{color:t.get_progress_color(parseFloat((t.memory.used/t.memory.total*100).toFixed(1)))}},[t._v(t._s(t.memory.used.toFixed(2))+" GB ")]),t._v("\n /"+t._s(t.memory.total.toFixed(2))+" GB)\n ")]),t._v(" "),s("Progress",{attrs:{percent:parseFloat((t.memory.used/t.memory.total*100).toFixed(1)),"stroke-color":t.get_progress_color(parseFloat((t.memory.used/t.memory.total*100).toFixed(1)))}})],1),t._v(" "),t._l(t.gpus,function(e,o){return s("Row",{key:o},[s("p",{staticStyle:{"font-weight":"bold"}},[t._v("\n "+t._s(e.name)+" \n "),s("span",{staticStyle:{color:"blue"}},[t._v("[gpu:"+t._s(o)+"]")]),t._v(" \n ("),s("span",{style:{color:t.get_progress_color(parseFloat((e.memory_used/e.memory_total*100).toFixed(1)))}},[t._v(t._s(e.memory_used)+" MB ")]),t._v("\n /"+t._s(e.memory_total)+" MB)\n ")]),t._v(" "),s("Progress",{attrs:{percent:parseFloat((e.memory_used/e.memory_total*100).toFixed(1)),"stroke-color":t.get_progress_color(parseFloat((e.memory_used/e.memory_total*100).toFixed(1)))}})],1)})],2),t._v(" "),t._l(Object.keys(t.progress),function(e){return s("Card",{key:e,staticStyle:{width:"100%","margin-bottom":"10px"}},[s("p",{staticStyle:{"font-size":"18px","font-weight":"bold",color:"#464c5b"},attrs:{slot:"title"},slot:"title"},[s("Icon",{staticStyle:{"margin-right":"3px"},attrs:{type:"ios-play"}}),t._v("\n Running Application: "),s("span",{staticStyle:{color:"green"}},[t._v(t._s(e))])],1),t._v(" "),s("Row",{staticStyle:{"margin-bottom":"10px","margin-left":"10px","margin-right":"10px"}},[s("Col",{attrs:{span:"24"}},t._l(Object.keys(t.progress[e]),function(o){return s("Card",{key:o,staticStyle:{"margin-right":"15px"}},[s("p",{staticStyle:{"font-weight":"bold","font-size":"16px"}},[s("Badge",{attrs:{status:t.isAllProgressFull(e,o)?"success":"processing"}}),t._v(t._s(o)+" ")],1),t._v(" "),s("Divider"),t._v(" "),t._l(Object.keys(t.progress[e][o]),function(n){return s("div",{key:n,staticStyle:{"margin-left":"25px"}},[s("span",{staticStyle:{"font-weight":"bold"}},[t._v(t._s(n))]),t._v(" "),s("Tag",{attrs:{color:t.progress[e][o][n][0]===t.progress[e][o][n][1]?"green":"geekblue"}},[t._v("\n "+t._s(t.progress[e][o][n][0])+"/"),s("span",{staticStyle:{"font-weight":"bold"}},[t._v(t._s(t.progress[e][o][n][1]))])]),t._v(" "),s("Progress",{staticStyle:{"padding-right":"5%"},attrs:{percent:parseFloat((t.progress[e][o][n][0]/t.progress[e][o][n][1]*100).toFixed(1)),status:"active"}})],1)}),t._v(" "),e in t.curr_status&&o in t.curr_status[e]?s("div",{staticStyle:{"margin-left":"25px"}},t._l(Object.keys(t.curr_status[e][o]),function(n){return s("div",{key:n,staticStyle:{"margin-left":"5px"}},[s("span",{staticStyle:{"font-weight":"bold"}},[t._v(t._s(n)+" : ")]),t._v(" "),"number"==typeof t.curr_status[e][o][n]?s("span",[t._v("\n "+t._s(parseFloat(t.curr_status[e][o][n].toFixed(5)))+"\n \n "),t.curr_status[e][o][n]-t.last_status[e][o][n]>0?[s("Icon",{staticStyle:{color:"green"},attrs:{type:"md-arrow-dropup",size:"18"}}),t._v(" "),s("span",{staticStyle:{color:"green"}},[t._v("\n +"+t._s(parseFloat((t.curr_status[e][o][n]-t.last_status[e][o][n]).toFixed(5)))+"\n ")])]:t.curr_status[e][o][n]-t.last_status[e][o][n]<0?[s("Icon",{staticStyle:{color:"red"},attrs:{type:"md-arrow-dropdown",size:"18"}}),t._v(" "),s("span",{staticStyle:{color:"red"}},[t._v("\n "+t._s(parseFloat((t.curr_status[e][o][n]-t.last_status[e][o][n]).toFixed(5)))+"\n ")])]:t._e()],2):s("span",{staticStyle:{color:"blue"}},[t._v(t._s(t.curr_status[e][o][n]))])])}),0):t._e()],2)}),1)],1),t._v(" "),s("Divider")],1)}),t._v(" "),s("Card",{staticStyle:{width:"100%"}},[s("p",{staticStyle:{"font-size":"18px","font-weight":"bold",color:"#464c5b"},attrs:{slot:"title"},slot:"title"},[s("Icon",{staticStyle:{color:"#464c5b"},attrs:{type:"md-settings",size:"20"}}),t._v("\n Configuration\n ")],1),t._v(" "),s("Row",{staticStyle:{"margin-bottom":"10px","margin-left":"10px","margin-right":"10px"}},[s("Col",{attrs:{span:"12"}},[s("p",{staticStyle:{"font-size":"16px",color:"#464c5b"}},[t._v("Select Configuration: ")])]),t._v(" "),s("Col",{attrs:{span:"12"}},[s("Select",{staticStyle:{width:"100%"},attrs:{filterable:"",placeholder:"please select..."},model:{value:t.selected_config,callback:function(e){t.selected_config=e},expression:"selected_config"}},t._l(Object.keys(this.configs),function(e){return s("Option",{key:e,attrs:{value:e}},[t._v(t._s(e))])}),1)],1)],1),t._v(" "),s("Divider"),t._v(" "),s("Card",[s("Tree",{attrs:{data:t.config_data}})],1)],1)],2)],1)],1)},staticRenderFns:[function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticStyle:{display:"flex","justify-content":"center"}},[e("h1",[this._v("Project Dashboard")])])}]};var y=s("VU/8")(f,h,!1,function(t){s("Q8n0")},"data-v-175e3abe",null).exports,b={render:function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticStyle:{padding:"20px"}},[t._m(0),t._v(" "),s("Divider"),t._v(" "),s("Alert",{attrs:{type:t.notice_status,"show-icon":""}},[t._v("\n "+t._s(t.notice_msg)+"\n ")]),t._v(" "),s("Row",{staticStyle:{"padding-right":"20%","padding-left":"15%"}},[s("Col",{attrs:{span:6}},[s("span",{staticStyle:{"font-size":"16px","font-weight":"bold"}},[t._v("Tensorboard Log Directory")])]),t._v(" "),s("Col",{attrs:{span:15}},[s("AutoComplete",{staticStyle:{"margin-bottom":"20px"},attrs:{data:t.tensorboard_dirs,placeholder:"Enter or choose one 'log_dir' ..."},model:{value:t.log_dir,callback:function(e){t.log_dir=e},expression:"log_dir"}})],1),t._v(" "),s("Col",{attrs:{offset:"1"}},[s("Button",{attrs:{icon:"ios-play",type:"primary"},on:{click:t.run_tensorboard}},[t._v("Run")])],1)],1),t._v(" "),s("Divider"),t._v(" "),s("Row",{staticStyle:{"margin-top":"20px"},attrs:{type:"flex"}},t._l(t.running_tensorboards,function(e,o){return s("Col",{key:e,staticStyle:{"margin-right":"10px"},attrs:{span:8}},[s("Card",[s("p",{staticStyle:{"font-weight":"bold"},attrs:{slot:"title"},slot:"title"},[t._v("TensorBoard")]),t._v(" "),s("a",{attrs:{slot:"extra",href:e,target:"_blank"},slot:"extra"},[t._v(t._s(e))]),t._v(" "),s("iframe",{attrs:{src:e,width:"100%",height:"400px",frameborder:"0"}}),t._v(" "),s("Divider"),t._v(" "),s("Tag",[t._v("Log Directory:")]),t._v(" "),s("Input",{attrs:{type:"textarea",readonly:"",placeholder:"Enter something..."},model:{value:o,callback:function(t){o=t},expression:"log_dir"}})],1)],1)}),1)],1)},staticRenderFns:[function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticStyle:{display:"flex","justify-content":"center"}},[e("h1",[this._v("Tensorboard")])])}]};var x=s("VU/8")({name:"Tensorboard",data:function(){return{log_dir:"",notice_msg:"Please enter the log directory to run TensorBoard.",notice_status:"info",tensorboard_dirs:[],running_tensorboards:{}}},mounted:function(){this.get_tensorboard_dirs(),this.get_running_tensorboards()},methods:{run_tensorboard:function(){var t=this,e={log_dir:this.log_dir};this.$ajax.postjson("/tensorboard/run",e).then(function(e){"success"===e.status?(t.notice_msg=e.message,t.notice_status="success"):"warning"===e.status?(t.tensorboardUrl=e.url,t.notice_msg=e.message,t.notice_status="warning"):(t.notice_msg=e.message,t.notice_status="error"),t.get_running_tensorboards()})},get_tensorboard_dirs:function(){var t=this;this.$ajax.postjson("/tensorboard/dirs",{}).then(function(e){t.tensorboard_dirs=e.tensorboard_dirs})},get_running_tensorboards:function(){var t=this;this.$ajax.postjson("/tensorboard/running_tensorboards",{}).then(function(e){t.running_tensorboards=e.running_tensorboards})}}},b,!1,function(t){s("Rypp")},"data-v-5ac31ad5",null).exports,S={data:function(){return{project_name:"PyTorchBoot",sub_navi_name:["Project Dashboard","Tensorboard"],curr_sub_navi_idx:0,components:[y,x]}},mounted:function(){},computed:{currentComponent:function(){return this.components[this.curr_sub_navi_idx]}},methods:{handleMenuSelect:function(t){this.curr_navi_idx=parseInt(t)-1},handleSubMenuSelect:function(t){this.curr_sub_navi_idx=parseInt(t)-1}}},w={render:function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"layout"},[s("Menu",{attrs:{mode:"horizontal",theme:"dark","active-name":"1"},on:{"on-select":t.handleMenuSelect}},[s("div",{staticClass:"layout-logo"},[t._v(t._s(t.project_name))])]),t._v(" "),s("Menu",{staticClass:"sub_menu",attrs:{mode:"horizontal","active-name":"1"},on:{"on-select":t.handleSubMenuSelect}},[s("div",{staticClass:"layout-assistant"},[s("Menu-item",{attrs:{name:"1"}},[s("Icon",{attrs:{type:"md-pie",size:"16"}}),t._v(t._s(t.sub_navi_name[0])+"\n ")],1),t._v(" "),s("Menu-item",{attrs:{name:"2"}},[s("Icon",{attrs:{type:"ios-stats",size:"16"}}),t._v(t._s(t.sub_navi_name[1])+"\n ")],1)],1)]),t._v(" "),s("div",{staticClass:"layout-breadcrumb"},[s("Breadcrumb",{attrs:{separator:">"}},[s("Breadcrumb-item",[t._v(t._s(t.project_name))]),t._v(" "),s("Breadcrumb-item",[t._v(t._s(t.sub_navi_name[t.curr_sub_navi_idx]))])],1)],1),t._v(" "),s("div",{staticClass:"layout-content"},[s(t.currentComponent,{tag:"component"})],1),t._v(" "),s("div",{staticClass:"layout-copy"},[t._v("\n PyTorchBoot © Author: lexhofee@gmail.com\n ")])],1)},staticRenderFns:[]};var j=s("VU/8")(S,w,!1,function(t){s("j7pU")},"data-v-6cac4c0c",null).exports,C=s("uXZL"),k=s.n(C),F=s("mvHQ"),T=s.n(F),R=s("//Fk"),z=s.n(R),M=s("mw3O"),P=s.n(M),B=s("mtWM"),I=s.n(B),$="http://localhost:5000",O={post:function(t,e){return I.a.defaults.headers.post["Content-Type"]="application/x-www-form-urlencoded",I.a.defaults.transformRequest=[function(t){return P.a.stringify(t)}],console.log("post",$,t),I.a.post(""+$+t,e).then(function(t){if(console.log("res:",t),200==t.status)return void 0!=t.data.exception&&t.data.exception?(i.Message.error(t.data.msg),z.a.reject(t.data)):t.data;i.Message.error("server error")})},postjson:function(t,e){return I.a.defaults.headers.post["Content-Type"]="application/json;charset=utf-8",I.a.defaults.transformRequest=[function(t){return T()(t)}],console.log("postjson",$,t),I.a.post(""+$+t,e).then(function(t){if(console.log("res:",t),200==t.status)return void 0!=t.data.exception&&t.data.exception?(i.Message.error(t.data.msg),z.a.reject(t.data)):t.data;i.Message.error("server error")})},getServerHost:function(){return"localhost"},postfile:function(t,e,s){return console.log("postfile:",t,e),I.a.defaults.headers.post["Content-Type"]="multipart/form-data;",I.a.defaults.transformRequest=[function(t){return t}],console.log("postfile",$,t),I.a.post(""+$+t,e).then(function(t){if(console.log("res:",t),200==t.status)return void 0!=t.data.exception&&t.data.exception?(i.Message.error(t.data.msg),z.a.reject(t.data)):t.data;i.Message.error("server error")})},download:function(t,e){I()({method:"get",url:""+$+t,responseType:"blob"}).then(function(t){var s=new Blob([t.data]);console.log(s.size);var o=window.URL.createObjectURL(s),n=document.createElement("a");n.href=o,n.download=e,n.click(),window.URL.revokeObjectURL(o)})}};o.default.use(c.a),o.default.use(k.a),o.default.prototype.$ajax=O,o.default.config.productionTip=!1,o.default.use(a.a);var A=new a.a({routes:[{path:"/",name:"Main",component:j,meta:{title:"PyTorch Boot Project"}},{path:"*",name:"Page404",component:u,meta:{title:"PyTorch Boot Project"}}]});o.default.use(c.a),o.default.prototype.$ajax=O,o.default.config.productionTip=!1,new o.default({el:"#app",router:A,components:{App:r},template:"<App/>"})},Q8n0:function(t,e){},Rypp:function(t,e){},j7pU:function(t,e){}},["NHnr"]);
//# sourceMappingURL=app.230235873e25a72eeacb.js.map