blob: 941cd7a072f3a6fab3afb21a8f1f221abdeeb478 [file] [log] [blame]
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["complex-table"],{"333d":function(e,t,n){"use strict";var a=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)},i=[],r=n("d225"),o=n("b0b4"),c=n("308d"),u=n("6bb5"),s=n("4e2b"),l=n("9ab4"),d=n("60a3"),p=function(e,t,n,a){return e/=a/2,e<1?n/2*e*e+t:(e--,-n/2*(e*(e-2)-1)+t)},f=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(e){window.setTimeout(e,1e3/60)}}(),b=function(e){document.documentElement.scrollTop=e,document.body.parentNode.scrollTop=e,document.body.scrollTop=e},m=function(){return document.documentElement.scrollTop||document.body.parentNode.scrollTop||document.body.scrollTop},h=function(e,t,n){var a=m(),i=e-a,r=20,o=0;t="undefined"===typeof t?500:t;var c=function e(){o+=r;var c=p(o,a,i,t);b(c),o<t?f(e):n&&"function"===typeof n&&n()};c()},g=function(e){function t(){return Object(r["a"])(this,t),Object(c["a"])(this,Object(u["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&&h(0,800)}},{key:"handleCurrentChange",value:function(e){this.$emit("pagination",{page:e,limit:this.pageSize}),this.autoScroll&&h(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}(d["c"]);l["a"]([Object(d["b"])({required:!0})],g.prototype,"total",void 0),l["a"]([Object(d["b"])({default:1})],g.prototype,"page",void 0),l["a"]([Object(d["b"])({default:20})],g.prototype,"limit",void 0),l["a"]([Object(d["b"])({default:function(){return[10,20,30,50]}})],g.prototype,"pageSizes",void 0),l["a"]([Object(d["b"])({default:"total, sizes, prev, pager, next, jumper"})],g.prototype,"layout",void 0),l["a"]([Object(d["b"])({default:!0})],g.prototype,"background",void 0),l["a"]([Object(d["b"])({default:!0})],g.prototype,"autoScroll",void 0),l["a"]([Object(d["b"])({default:!1})],g.prototype,"hidden",void 0),g=l["a"]([Object(d["a"])({name:"Pagination"})],g);var v=g,y=v,j=(n("42e2"),n("2877")),w=Object(j["a"])(y,a,i,!1,null,"1ff35890",null);t["a"]=w.exports},"42e2":function(e,t,n){"use strict";var a=n("5390"),i=n.n(a);i.a},"4eba":function(e,t,n){"use strict";n.r(t);var a=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":""},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:"230","class-name":"fixed-width"},scopedSlots:e._u([{key:"default",fn:function(t){var a=t.row;return[n("el-button",{attrs:{type:"primary",size:"mini"},on:{click:function(t){return e.handleToEdit(a)}}},[e._v("\n "+e._s(e.$t("table.edit"))+"\n ")]),"deleted"!==a.status?n("el-button",{attrs:{size:"mini",type:"danger"},on:{click:function(t){return e.handleRemove(a)}}},[e._v("\n "+e._s(e.$t("table.delete"))+"\n ")]):e._e()]}}])})],2)],1)},i=[],r=(n("7f7f"),n("768b")),o=(n("ac6a"),n("ffc1"),n("75fc")),c=(n("96cf"),n("3b8d")),u=n("d225"),s=n("b0b4"),l=n("308d"),d=n("6bb5"),p=n("4e2b"),f=n("9ab4"),b=n("60a3"),m=n("333d"),h=n("c738"),g=function(e){function t(){var e;return Object(u["a"])(this,t),e=Object(l["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(p["a"])(t,e),Object(s["a"])(t,[{key:"created",value:function(){this.getList()}},{key:"getList",value:function(){var e=Object(c["a"])(regeneratorRuntime.mark((function e(){var t,n,a,i=this;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return this.listLoading=!0,this.tableKeys=[{key:"username",width:300},{key:"description",width:300,align:"left"},{key:"plugins",width:400}],e.next=4,Object(h["b"])();case 4:t=e.sent,n=t.node.nodes,a=void 0===n?[]:n,a=Object(o["a"])(a).map((function(e){var t=[],n=e.value,a=n.username,i=n.desc;return Object.entries(n.plugins).map((function(e){var n=Object(r["a"])(e,2),a=n[0],i=n[1];t.push({name:a,key:i.key})})),{username:a,plugins:t.map((function(e){return e.name})).join(", "),pluginArr:t,description:i}})),this.tableData=a,this.total=a.length,setTimeout((function(){i.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 consumer ".concat(e.username,"?"),"Warning",{confirmButtonText:"Confirm",cancelButtonText:"Cancel",type:"warning"}).then(Object(c["a"])(regeneratorRuntime.mark((function n(){return regeneratorRuntime.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return n.next=2,Object(h["c"])(e.username);case 2:t.getList(),t.$message.success("Remove consumer ".concat(e.username," 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:"SchemaConsumersCreate"})}},{key:"handleToEdit",value:function(e){this.$router.push({name:"SchemaConsumersEdit",params:{username:e.username}})}}]),t}(b["c"]);g=f["a"]([Object(b["a"])({name:"ComplexTable",components:{Pagination:m["a"]}})],g);var v=g,y=v,j=(n("b878"),n("2877")),w=Object(j["a"])(y,a,i,!1,null,null,null);t["default"]=w.exports},"504c":function(e,t,n){var a=n("9e1e"),i=n("0d58"),r=n("6821"),o=n("52a7").f;e.exports=function(e){return function(t){var n,c=r(t),u=i(c),s=u.length,l=0,d=[];while(s>l)n=u[l++],a&&!o.call(c,n)||d.push(e?[n,c[n]]:c[n]);return d}}},5390:function(e,t,n){},b32d:function(e,t,n){"use strict";var a=n("bc3a"),i=n.n(a),r=n("5c96"),o=i.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},b878:function(e,t,n){"use strict";var a=n("cb5c"),i=n.n(a);i.a},c738:function(e,t,n){"use strict";n.d(t,"d",(function(){return i})),n.d(t,"b",(function(){return r})),n.d(t,"a",(function(){return o})),n.d(t,"c",(function(){return c}));var a=n("b32d"),i=function(e){return Object(a["a"])({url:"/consumers",method:"PUT",data:e})},r=function(){return Object(a["a"])({url:"/consumers",method:"GET"})},o=function(e){return Object(a["a"])({url:"/consumers/".concat(e),method:"GET"})},c=function(e){return Object(a["a"])({url:"/consumers/".concat(e),method:"DELETE"})}},cb5c:function(e,t,n){e.exports={menuBg:"#304156",menuText:"#bfcbd9",menuActiveText:"#409eff"}},ffc1:function(e,t,n){var a=n("5ca1"),i=n("504c")(!0);a(a.S,"Object",{entries:function(e){return i(e)}})}}]);