emqx/apps/emqx_enterprise_dashboard/priv/www/static/js/chunk-2be77691.a1865558.js

1 line
8.4 KiB
JavaScript

(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2be77691"],{"0ea8":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:"blacklist"},[n("page-header",{attrs:{"back-title":e.$t("General.blacklist")}},[n("div",{staticClass:"page-header-content-view"},[n("div",{staticClass:"content"},[n("p",{staticClass:"description"},[e._v("\n "+e._s(e.$t("General.blacklistTips"))+"\n "),n("a",{attrs:{href:e.docs.tutorial,target:"_blank"}},[e._v("\n "+e._s(e.$t("General.authDocs"))+"\n ")])])])])]),n("div",{staticClass:"app-wrapper"},[n("a-card",{staticClass:"emq-list-card"},[n("div",{staticClass:"emq-table-header"},[n("el-button",{attrs:{type:"primary",size:"small",icon:"el-icon-plus"},on:{click:e.showDialog}},[e._v("\n "+e._s(e.$t("Base.create"))+"\n ")])],1),n("el-table",{staticClass:"data-list",attrs:{data:e.tableData}},[n("el-table-column",{attrs:{prop:"who","min-width":"120px",label:e.$t("General.who")}}),n("el-table-column",{attrs:{prop:"as","min-width":"120px",label:e.$t("General.as")}}),n("el-table-column",{attrs:{prop:"reason","min-width":"120px",label:e.$t("General.reason")}}),n("el-table-column",{attrs:{prop:"until","min-width":"120px",formatter:e.formatterUntil,label:e.$t("General.until")}}),n("el-table-column",{attrs:{prop:"oper",width:"120px",label:""},scopedSlots:e._u([{key:"default",fn:function(t){var a=t.row;return[n("el-button",{attrs:{type:"danger",size:"mini"},on:{click:function(t){return e.deleteConfirm(a)}}},[e._v(e._s(e.$t("General.delete"))+" ")])]}}])})],1),n("div",{staticClass:"emq-table-footer"},[n("el-pagination",{attrs:{"hide-on-single-page":"",background:"",layout:"total, sizes, prev, pager, next","page-sizes":[20,50,100,500],"page-size":e.params._limit,"current-page":e.params._page,total:e.count},on:{"update:pageSize":function(t){return e.$set(e.params,"_limit",t)},"update:page-size":function(t){return e.$set(e.params,"_limit",t)},"update:currentPage":function(t){return e.$set(e.params,"_page",t)},"update:current-page":function(t){return e.$set(e.params,"_page",t)},"size-change":e.handleSizeChange,"current-change":e.handleCurrentPageChange}})],1)],1)],1),n("el-dialog",{attrs:{width:"520px",title:e.$t("General.createBlacklist"),visible:e.dialogVisible},on:{"update:visible":function(t){e.dialogVisible=t},close:e.clearInput}},[n("el-form",{ref:"recordForm",attrs:{size:"small",model:e.record,rules:e.rules}},[n("el-row",{attrs:{gutter:20}},[n("el-col",{attrs:{span:12}},[n("el-form-item",{attrs:{prop:"as",label:e.$t("General.as")}},[n("emq-select",{attrs:{field:{options:e.asOptions}},model:{value:e.record.as,callback:function(t){e.$set(e.record,"as",t)},expression:"record.as"}})],1)],1),n("el-col",{attrs:{span:12}},[n("el-form-item",{attrs:{prop:"who",label:e.$t("General.who")}},[n("el-input",{model:{value:e.record.who,callback:function(t){e.$set(e.record,"who",t)},expression:"record.who"}})],1)],1),n("el-col",{attrs:{span:12}},[n("el-form-item",{attrs:{prop:"reason",label:e.$t("General.reason")}},[n("el-input",{model:{value:e.record.reason,callback:function(t){e.$set(e.record,"reason",t)},expression:"record.reason"}})],1)],1),n("el-col",{attrs:{span:12}},[n("el-form-item",{attrs:{prop:"until",label:e.$t("General.until")}},[n("el-date-picker",{attrs:{type:"datetime",format:"yyyy-MM-dd HH:mm:ss","value-format":"timestamp"},model:{value:e.record.until,callback:function(t){e.$set(e.record,"until",t)},expression:"record.until"}})],1)],1)],1)],1),n("div",{staticClass:"dialog-align-footer",attrs:{slot:"footer"},slot:"footer"},[n("el-button",{attrs:{plain:"",size:"small"},on:{click:e.closeDialog}},[e._v(e._s(e.$t("Base.cancel")))]),n("el-button",{attrs:{type:"primary",size:"small"},on:{click:e.save}},[e._v(e._s(e.$t("Base.confirm")))])],1)],1)],1)},r=[],s=n("cebc"),i=(n("96cf"),n("3b8d")),o=n("c1df"),l=n.n(o),c=n("72db"),u=n("90b9"),p={name:"Blacklist",components:{},props:{},data:function(){return{docs:{tutorial:Object(u["g"])("auth")},dialogVisible:!1,tableData:[],params:{_page:1,_limit:20},count:0,asOptions:[{label:"clientid",value:"clientid"},{label:"username",value:"username"},{label:"peerhost",value:"peerhost"}],record:{reason:""},rules:{as:[{required:!0,message:this.$t("General.enterAs")}],who:[{required:!0,message:this.$t("General.enterWho")}]}}},created:function(){this.loadData()},methods:{loadData:function(){this.listBlackList()},listBlackList:function(){var e=Object(i["a"])(regeneratorRuntime.mark(function e(t){var n,a,r,i,o,l,u=arguments;return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:return n=u.length>1&&void 0!==u[1]?u[1]:{},t&&(this.params._page=1),e.next=4,Object(c["i"])(Object(s["a"])({},this.params,n));case 4:a=e.sent,r=a.items,i=void 0===r?[]:r,o=a.meta.count,l=void 0===o?0:o,this.tableData=i,this.count=l;case 8:case"end":return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}(),handleSizeChange:function(){this.listBlackList(!0)},handleCurrentPageChange:function(){this.listBlackList()},clearInput:function(){this.$refs.recordForm&&this.$refs.recordForm.resetFields()},showDialog:function(){this.record={reason:""},this.dialogVisible=!0},closeDialog:function(){this.dialogVisible=!1},save:function(){var e=Object(i["a"])(regeneratorRuntime.mark(function e(){var t=this;return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:this.$refs.recordForm.validate(function(){var e=Object(i["a"])(regeneratorRuntime.mark(function e(n){var a,r;return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:if(n){e.next=2;break}return e.abrupt("return");case 2:if(a=Object(s["a"])({},t.record),a.until&&"number"===typeof a.until)try{a.until=Math.floor(a.until/1e3)}catch(i){a.until=null}return e.next=6,Object(c["c"])(a);case 6:r=e.sent,r&&(t.$message.success(t.$t("General.createBlacklistSuccess")),t.closeDialog(),t.listBlackList());case 8:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 1:case"end":return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}(),deleteConfirm:function(e){var t=this;this.$msgbox.confirm(this.$t("General.determineToDeleteTheBlacklist"),{confirmButtonText:this.$t("Base.confirm"),cancelButtonText:this.$t("Base.cancel"),type:"warning"}).then(Object(i["a"])(regeneratorRuntime.mark(function n(){var a,r,s;return regeneratorRuntime.wrap(function(n){while(1)switch(n.prev=n.next){case 0:return a=e.who,r=e.as,n.next=3,Object(c["e"])({who:a,as:r});case 3:s=n.sent,s&&(t.$message.success(t.$t("General.successfulDeletion")),t.listBlackList(!0));case 5:case"end":return n.stop()}},n)}))).catch(function(){})},formatterUntil:function(e){var t=e.until;return t&&"number"===typeof t?l()(1e3*t).format("YYYY-MM-DD HH:mm:ss"):this.$t("General.neverExpire")}}},d=p,f=(n("dd12"),n("2877")),m=Object(f["a"])(d,a,r,!1,null,"170091b5",null);t["default"]=m.exports},"15aca":function(e,t,n){},"72db":function(e,t,n){"use strict";n.d(t,"h",function(){return r}),n.d(t,"k",function(){return s}),n.d(t,"b",function(){return i}),n.d(t,"l",function(){return o}),n.d(t,"f",function(){return l}),n.d(t,"j",function(){return c}),n.d(t,"d",function(){return u}),n.d(t,"m",function(){return p}),n.d(t,"a",function(){return d}),n.d(t,"g",function(){return f}),n.d(t,"i",function(){return m}),n.d(t,"c",function(){return h}),n.d(t,"e",function(){return b});var a=n("1f75");function r(){return a["a"].get("/apps")}function s(e){return a["a"].get("/apps/".concat(e))}function i(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return a["a"].post("/apps",e)}function o(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return a["a"].put("/apps/".concat(e),t)}function l(e){return a["a"].delete("/apps/".concat(e))}function c(){return a["a"].get("/users")}function u(e){return a["a"].post("/users",e)}function p(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return a["a"].put("/users/".concat(e),t)}function d(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return a["a"].put("/change_pwd/".concat(e),t)}function f(e){return a["a"].delete("/users/".concat(e))}function m(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return a["a"].get("/banned",{params:e})}function h(e){return a["a"].post("/banned",e)}function b(e){var t=e.who,n=e.as;return a["a"].delete("/banned/".concat(n,"/").concat(encodeURIComponent(t)))}},dd12:function(e,t,n){"use strict";var a=n("15aca"),r=n.n(a);r.a}}]);