blob: 9eeec2c1d5cfe12184e456b4cc9250749ad35846 [file] [log] [blame]
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-0e9b6916"],{"0e01":function(e,t,n){"use strict";n.r(t);var i=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"app-container"},[n("div",{staticClass:"filter-container"},[n("el-button",{staticClass:"filter-item",staticStyle:{"margin-left":"10px"},attrs:{type:"primary",icon:"el-icon-edit"},on:{click:e.handleCreate}},[e._v("\n "+e._s(e.$t("table.add"))+"\n ")])],1),n("el-table",{directives:[{name:"loading",rawName:"v-loading",value:e.listLoading,expression:"listLoading"}],key:e.tableKey,staticStyle:{width:"100%"},attrs:{data:e.tableData,border:!1,fit:"","highlight-current-row":"","default-sort":{prop:"id",order:"descending"}},on:{"sort-change":e.sortChange}},[e._l(e.tableKeys,(function(e,t){return n("el-table-column",{key:t,attrs:{label:e.key,prop:e.key,width:e.width,"class-name":"left"===e.align?"":"status-col","header-align":"center"}})})),n("el-table-column",{attrs:{label:e.$t("table.actions"),align:"center",width:"200","class-name":"fixed-width",fixed:"right"},scopedSlots:e._u([{key:"default",fn:function(t){var i=t.row;return[n("el-button",{attrs:{type:"primary",size:"mini"},on:{click:function(t){return e.handleToEdit(i)}}},[e._v("\n "+e._s(e.$t("table.edit"))+"\n ")]),"deleted"!==i.status?n("el-button",{attrs:{size:"mini",type:"danger"},on:{click:function(t){return e.handleRemove(i)}}},[e._v("\n "+e._s(e.$t("table.delete"))+"\n ")]):e._e()]}}])})],2)],1)},a=[],r=(n("ac6a"),n("456d"),n("a481"),n("4917"),n("75fc")),o=(n("96cf"),n("3b8d")),u=n("d225"),c=n("b0b4"),s=n("308d"),d=n("6bb5"),l=n("4e2b"),p=n("9ab4"),h=n("60a3"),f=n("333d"),b=n("80a7"),g=function(e){function t(){var e;return Object(u["a"])(this,t),e=Object(s["a"])(this,Object(d["a"])(t).apply(this,arguments)),e.tableKey=0,e.list=[],e.total=0,e.listLoading=!0,e.listQuery={page:1,limit:20,importance:void 0,title:void 0,type:void 0,sort:"+id"},e.tableData=[],e.tableKeys=[],e}return Object(l["a"])(t,e),Object(c["a"])(t,[{key:"created",value:function(){this.getList()}},{key:"getList",value:function(){var e=Object(o["a"])(regeneratorRuntime.mark((function e(){var t,n,i,a=this;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return this.listLoading=!0,this.tableKeys=[{key:"id",width:80},{key:"description",width:300,align:"left"},{key:"uri",width:200},{key:"host",width:200},{key:"remote_addr",width:200},{key:"upstream_id",width:200},{key:"service_id",width:200},{key:"methods",width:200},{key:"plugins",width:400}],e.next=4,Object(b["b"])();case 4:t=e.sent,n=t.node.nodes,i=void 0===n?[]:n,i=Object(r["a"])(i).map((function(e){var t=e.key.match(/\/([0-9]+)/)[1],n=parseInt(t.replace(/^(0+)/,"")),i=e.value,a=i.uri,r=void 0===a?"":a,o=i.host,u=void 0===o?"":o,c=i.remote_addr,s=void 0===c?"":c,d=i.upstream_id,l=void 0===d?"":d,p=i.service_id,h=void 0===p?"":p,f=i.methods,b=void 0===f?[]:f,g=i.plugins,m=void 0===g?{}:g,v=i.desc,y=void 0===v?"":v;return b=b.join(", "),e.value.uris&&(r=e.value.uris.join(", ")),e.value.hosts&&(u=e.value.hosts.join("\n ")),m=Object.keys(m).join(", "),{id:n,realId:t,uri:r,host:u,remote_addr:s,upstream_id:l&&String(l).replace(/^(0+)/,""),service_id:h&&String(h).replace(/^(0+)/,""),methods:b,plugins:m,description:y}})),this.tableData=i,this.total=i.length,setTimeout((function(){a.listLoading=!1}),500);case 11:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"handleFilter",value:function(){this.listQuery.page=1,this.getList()}},{key:"handleRemove",value:function(e){var t=this;this.$confirm("Do you want to remove router ".concat(e.id,"?"),"Warning",{confirmButtonText:"Confirm",cancelButtonText:"Cancel",type:"warning"}).then(Object(o["a"])(regeneratorRuntime.mark((function n(){return regeneratorRuntime.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return n.next=2,Object(b["d"])(e.realId);case 2:t.getList(),t.$message.success("Remove router ".concat(e.id," successfully!"));case 4:case"end":return n.stop()}}),n)}))))}},{key:"sortChange",value:function(e){var t=e.prop,n=e.order;"id"===t&&this.sortByID(n)}},{key:"sortByID",value:function(e){this.listQuery.sort="ascending"===e?"+id":"-id",this.handleFilter()}},{key:"handleCreate",value:function(){this.$router.push({name:"SchemaRoutesCreate"})}},{key:"handleToEdit",value:function(e){this.$router.push({name:"SchemaRoutesEdit",params:{id:e.realId}})}}]),t}(h["c"]);g=p["a"]([Object(h["a"])({name:"RoutesList",components:{Pagination:f["a"]}})],g);var m=g,v=m,y=n("2877"),w=Object(y["a"])(v,i,a,!1,null,null,null);t["default"]=w.exports},"333d":function(e,t,n){"use strict";var i=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"pagination-container",class:{hidden:e.hidden}},[n("el-pagination",e._b({attrs:{background:e.background,"current-page":e.currentPage,"page-size":e.pageSize,layout:e.layout,"page-sizes":e.pageSizes,total:e.total},on:{"update:currentPage":function(t){e.currentPage=t},"update:current-page":function(t){e.currentPage=t},"update:pageSize":function(t){e.pageSize=t},"update:page-size":function(t){e.pageSize=t},"size-change":e.handleSizeChange,"current-change":e.handleCurrentChange}},"el-pagination",e.$attrs,!1))],1)},a=[],r=n("d225"),o=n("b0b4"),u=n("308d"),c=n("6bb5"),s=n("4e2b"),d=n("9ab4"),l=n("60a3"),p=function(e,t,n,i){return e/=i/2,e<1?n/2*e*e+t:(e--,-n/2*(e*(e-2)-1)+t)},h=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(e){window.setTimeout(e,1e3/60)}}(),f=function(e){document.documentElement.scrollTop=e,document.body.parentNode.scrollTop=e,document.body.scrollTop=e},b=function(){return document.documentElement.scrollTop||document.body.parentNode.scrollTop||document.body.scrollTop},g=function(e,t,n){var i=b(),a=e-i,r=20,o=0;t="undefined"===typeof t?500:t;var u=function e(){o+=r;var u=p(o,i,a,t);f(u),o<t?h(e):n&&"function"===typeof n&&n()};u()},m=function(e){function t(){return Object(r["a"])(this,t),Object(u["a"])(this,Object(c["a"])(t).apply(this,arguments))}return Object(s["a"])(t,e),Object(o["a"])(t,[{key:"handleSizeChange",value:function(e){this.$emit("pagination",{page:this.currentPage,limit:e}),this.autoScroll&&g(0,800)}},{key:"handleCurrentChange",value:function(e){this.$emit("pagination",{page:e,limit:this.pageSize}),this.autoScroll&&g(0,800)}},{key:"currentPage",get:function(){return this.page},set:function(e){this.$emit("update:page",e)}},{key:"pageSize",get:function(){return this.limit},set:function(e){this.$emit("update:limit",e)}}]),t}(l["c"]);d["a"]([Object(l["b"])({required:!0})],m.prototype,"total",void 0),d["a"]([Object(l["b"])({default:1})],m.prototype,"page",void 0),d["a"]([Object(l["b"])({default:20})],m.prototype,"limit",void 0),d["a"]([Object(l["b"])({default:function(){return[10,20,30,50]}})],m.prototype,"pageSizes",void 0),d["a"]([Object(l["b"])({default:"total, sizes, prev, pager, next, jumper"})],m.prototype,"layout",void 0),d["a"]([Object(l["b"])({default:!0})],m.prototype,"background",void 0),d["a"]([Object(l["b"])({default:!0})],m.prototype,"autoScroll",void 0),d["a"]([Object(l["b"])({default:!1})],m.prototype,"hidden",void 0),m=d["a"]([Object(l["a"])({name:"Pagination"})],m);var v=m,y=v,w=(n("b056"),n("2877")),j=Object(w["a"])(y,i,a,!1,null,"01722ae9",null);t["a"]=j.exports},4917:function(e,t,n){"use strict";var i=n("cb7c"),a=n("9def"),r=n("0390"),o=n("5f1b");n("214f")("match",1,(function(e,t,n,u){return[function(n){var i=e(this),a=void 0==n?void 0:n[t];return void 0!==a?a.call(n,i):new RegExp(n)[t](String(i))},function(e){var t=u(n,e,this);if(t.done)return t.value;var c=i(e),s=String(this);if(!c.global)return o(c,s);var d=c.unicode;c.lastIndex=0;var l,p=[],h=0;while(null!==(l=o(c,s))){var f=String(l[0]);p[h]=f,""===f&&(c.lastIndex=r(s,a(c.lastIndex),d)),h++}return 0===h?null:p}]}))},"6b99":function(e,t,n){},"80a7":function(e,t,n){"use strict";n.d(t,"b",(function(){return a})),n.d(t,"e",(function(){return r})),n.d(t,"c",(function(){return o})),n.d(t,"d",(function(){return u})),n.d(t,"a",(function(){return c}));var i=n("b32d"),a=function(){return Object(i["a"])({url:"/routes",method:"GET"})},r=function(e,t){return Object(i["a"])({url:"/routes/".concat(e),method:"PUT",data:t})},o=function(e){return Object(i["a"])({url:"/routes/".concat(e),method:"GET"})},u=function(e){return Object(i["a"])({url:"/routes/".concat(e),method:"DELETE"})},c=function(e){return Object(i["a"])({url:"/routes",method:"POST",data:e})}},b056:function(e,t,n){"use strict";var i=n("6b99"),a=n.n(i);a.a},b32d:function(e,t,n){"use strict";var i=n("bc3a"),a=n.n(i),r=n("5c96"),o=a.a.create({baseURL:"/apisix/admin/",timeout:5e3});o.interceptors.request.use((function(e){return e}),(function(e){Promise.reject(e)})),o.interceptors.response.use((function(e){return e.data}),(function(e){return Object(r["Message"])({message:e.response.data.error_msg||e.message,type:"error",duration:5e3}),Promise.reject(e)})),t["a"]=o}}]);