webpackJsonp([9],{TK64:function(t,e){},"qB/b":function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=a("fZjL"),n=a.n(s),r=a("mvHQ"),o=a.n(r),i=a("zL8q"),p=[{path:"/auth",name:"auth_user",method:"POST",descr:"Authenticate an user"},{path:"/users/",name:"create_user",method:"POST",descr:"Create an user"},{path:"/users/",name:"list_users",method:"GET",descr:"List users"},{path:"/users/:name",name:"update_user",method:"PUT",descr:"Update an user"},{path:"/users/:name",name:"delete_user",method:"DELETE",descr:"Delete an user"},{path:"/change_pwd/:username",name:"change_pwd",method:"PUT",descr:"Change password for an user"},{path:"/apps/",name:"add_app",method:"POST",descr:"Add Application"},{path:"/apps/:appid",name:"del_app",method:"DELETE",descr:"Delete Application"},{path:"/apps/",name:"list_apps",method:"GET",descr:"List Applications"},{path:"/apps/:appid",name:"lookup_app",method:"GET",descr:"Lookup Application"},{path:"/apps/:appid",name:"update_app",method:"PUT",descr:"Update Application"}],l={name:"http-api",components:{"el-button":i.Button,"el-table":i.Table,"el-table-column":i.TableColumn,"el-card":i.Card},data:function(){return{popoverVisible:!1,nodeName:"emqx@127.0.0.1",tableData:[],nodes:[],responseDate:null,scrollTop:0,uri:""}},computed:{jsonFormatter:function(){var t=o()(this.responseDate,null,"\t");return t=(t=t.replace(/\n/g,"
")).replace(/\t/g,"    ")}},watch:{nodeInfo:"setApiData"},methods:{isLink:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.target&&-1===t.target.indexOf(":")},init:function(){var t=this,e=this.$store.state.nodeName;this.$httpGet("/nodes").then(function(a){t.nodeName=e||a.data[0].node,t.nodes=a.data,t.setApiData()}).catch(function(e){t.$message.error(e||t.$t("error.networkError"))})},loadResponse:function(t){var e=this;if(!(!(arguments.length>1&&void 0!==arguments[1])||arguments[1]))return this.responseDate=null,void(document.documentElement.scrollTop=this.scrollTop);if(this.isLink(t)){this.uri="/api/v4"+t.target,this.scrollTop=document.documentElement.scrollTop,document.documentElement.scrollTop=0;var a=function(a){a(t.target).then(e.handleSuccess).catch(e.handleError)};switch(t.method){case"GET":a(this.$httpGet);break;case"POST":a(this.$httpPost);break;case"PUT":a(this.$httpPut);break;default:this.responseDate=null}}},handleSuccess:function(t){this.responseDate=t.data},handleError:function(t){this.$message.error(t||this.$t("error.networkError"))},setApiData:function(){var t=this;this.$httpGet("/").then(function(e){t.tableData=[];var a=o()(e.data);a=a.replace(/:node/g,t.nodeName),a=(a=JSON.parse(a)).filter(function(t){return p.every(function(e){return e.path!==t.path})}),n()(a).forEach(function(e){t.tableData.push({method:a[e].method,path:"/api/v4"+(a[e].path.startsWith("/")?a[e].path:"/"+a[e].path),target:a[e].path,description:a[e].descr})})})}},created:function(){this.init()}},d={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"http-api"},[a("div",{staticClass:"page-title"},[t._v("\n "+t._s(t.$t("leftbar.api"))+"\n ")]),t._v(" "),a("el-card",{staticClass:"el-card--self"},[a("div",{attrs:{slot:"header"},slot:"header"},[a("span",[t._v(t._s(t.$t("httpApi.introduction")))])]),t._v(" "),a("div",{staticClass:"desc--text",domProps:{innerHTML:t._s(t.$t("httpApi.desc"))}})]),t._v(" "),a("el-card",{staticClass:"el-card--self"},[a("div",{attrs:{slot:"header"},slot:"header"},[t.responseDate?t._e():a("span",[t._v(t._s(t.$t("httpApi.reference")))]),t._v(" "),t.responseDate?a("el-button",{staticClass:"refresh-btn",attrs:{type:"text"},on:{click:function(e){return t.loadResponse(null,!1)}}},[a("i",{staticClass:"el-icon-arrow-left"}),t._v("\n "+t._s(t.$t("httpApi.back"))+"\n ")]):t._e()],1),t._v(" "),t.responseDate?t._e():a("el-table",{directives:[{name:"loading",rawName:"v-loading",value:t.$store.state.loading,expression:"$store.state.loading"}],attrs:{border:"",data:t.tableData}},[a("el-table-column",{attrs:{prop:"method",width:"120",label:t.$t("httpApi.method")}}),t._v(" "),a("el-table-column",{attrs:{"min-width":"160",label:t.$t("httpApi.path")},scopedSlots:t._u([{key:"default",fn:function(e){return[a("a",{class:["link",t.isLink(e.row)?"":"link-disabled"],attrs:{href:"javascript:;"},on:{click:function(a){return t.loadResponse(e.row)}}},[t._v("\n "+t._s(e.row.path)+"\n ")])]}}],null,!1,250455254)}),t._v(" "),a("el-table-column",{attrs:{"min-width":"240",label:t.$t("httpApi.description")},scopedSlots:t._u([{key:"default",fn:function(e){return[a("div",{domProps:{innerHTML:t._s(e.row.description)}})]}}],null,!1,3142742130)})],1),t._v(" "),t.responseDate?a("div",{staticClass:"response-container"},[a("div",{staticClass:"response-header"},[a("h3",[t._v("\n "+t._s(t.$t("httpApi.linkAddress"))+" :\n "),a("a",{attrs:{href:"javascript:;"}},[t._v(t._s(t.uri))])]),t._v(" "),a("h3",[t._v(t._s(t.$t("httpApi.data"))+" :")])]),t._v(" "),a("div",{staticClass:"response.body",domProps:{innerHTML:t._s(t.jsonFormatter)}})]):t._e()],1)],1)},staticRenderFns:[]};var c=a("VU/8")(l,d,!1,function(t){a("TK64")},null,null);e.default=c.exports}});