emqx/apps/emqx_enterprise_dashboard/priv/www/static/js/chunk-e7f1aeea.93c28ea9.js

1 line
7.2 KiB
JavaScript

(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-e7f1aeea"],{"0af6":function(e,t,n){},"715f":function(e,t,n){},8602:function(e,t,n){"use strict";var a=n("0af6"),s=n.n(a);s.a},9144:function(e,t,n){"use strict";var a=n("715f"),s=n.n(a);s.a},d7a3:function(e,t,n){"use strict";var a=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("ul",{staticClass:"resources-node"},e._l(e.value.status,function(t,a){return n("li",{key:a},[n("a-badge",{attrs:{"is-dot":"",status:t.is_alive?"success":"error"}}),n("span",{staticClass:"node-name"},[e._v(e._s(t.node))]),t.is_alive?e._e():n("el-button",{attrs:{type:"danger",size:"mini",loading:t.loading},on:{click:function(n){return e.resourceReconnect(t)}}},[e._v("\n "+e._s(e.$t("RuleEngine.reconnect"))+"\n ")])],1)}),0)},s=[],i=n("bd43"),r={name:"ResourceNode",components:{},props:{value:{type:Object,required:!0}},data:function(){return{}},created:function(){},methods:{resourceReconnect:function(e){var t=this;this.$set(e,"loading",!0),Object(i["o"])(this.value.id).then(function(){t.$set(e,"loading",!1),t.$emit("change",t.value,!0)}).catch(function(){t.$set(e,"loading",!1)})}}},o=r,c=(n("9144"),n("2877")),u=Object(c["a"])(o,a,s,!1,null,null,null);t["a"]=u.exports},e9f7: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:"resources"},[n("div",{staticClass:"app-wrapper"},[n("a-card",{staticClass:"emq-list-card",attrs:{loading:e.listLoading}},[n("div",{staticClass:"emq-table-header"},[n("el-button",{attrs:{type:"primary",size:"small",icon:"el-icon-plus"},on:{click:function(t){return e.handleDialogVisible("add")}}},[e._v("\n "+e._s(e.$t("Base.create"))+"\n ")])],1),n("el-table",{staticClass:"data-list",attrs:{data:e.tableData},on:{"expand-change":e.handleExpandChange}},[n("el-table-column",{attrs:{"class-name":"expand-column",prop:"id",type:"expand",width:"1px"},scopedSlots:e._u([{key:"default",fn:function(t){var a=t.row;return[n("a-card",{staticClass:"resource-node-wrapper",attrs:{loading:a.loading}},[n("el-row",{attrs:{gutter:40}},[n("el-col",{attrs:{span:12}},[n("div",{staticClass:"emq-title h3"},[e._v("\n "+e._s(e.$t("RuleEngine.resourceStatus"))+"\n "),n("div",{staticClass:"sub-title"},[e._v("\n "+e._s(e.$t("RuleEngine.resourceStatusTips"))+"\n ")])]),n("resource-node",{attrs:{value:a},on:{change:e.handleExpandChange}})],1)],1)],1)]}}])}),n("el-table-column",{attrs:{prop:"id","min-width":"80px",label:e.$t("RuleEngine.resourceID")},scopedSlots:e._u([{key:"default",fn:function(t){var a=t.row;return[n("span",{staticClass:"btn",on:{click:function(t){return e.showResource(a)}}},[e._v(e._s(a.id))])]}}])}),n("el-table-column",{attrs:{prop:"config.title","show-overflow-tooltip":"",label:e.$t("RuleEngine.resourceTypes"),filters:e.filterOptions.resourceTypes,"filter-method":e.resourceTypesColumnFilter,"filter-placement":"bottom"}}),n("el-table-column",{attrs:{"min-width":"100px",prop:"description","show-overflow-tooltip":"",label:e.$t("RuleEngine.resourceDes")}}),n("el-table-column",{attrs:{prop:"isAvailable"},scopedSlots:e._u([{key:"default",fn:function(t){var a=t.row;return[n("a-badge",{staticStyle:{"font-size":"12px"},attrs:{status:a.isAvailable?"success":"error",text:a.isAvailable?e.$t("RuleEngine.available"):e.$t("RuleEngine.notAvailable"),dot:""}})]}}])}),n("el-table-column",{attrs:{width:"200px",prop:"id"},scopedSlots:e._u([{key:"default",fn:function(t){var a=t.row,s=t.$index;return[n("el-button",{attrs:{type:"dashed",size:"mini"},on:{click:function(t){return e.viewResourcesStatus(a,s)}}},[e._v("\n "+e._s(e.$t("RuleEngine.status"))+"\n ")]),n("el-button",{attrs:{type:"dashed",size:"mini"},on:{click:function(t){return e.handleDialogVisible("edit",a)}}},[e._v("\n "+e._s(e.$t("RuleEngine.edit"))+"\n ")]),n("el-button",{attrs:{type:"dashed danger",size:"mini"},on:{click:function(t){return e.deleteResource(a)}}},[e._v("\n "+e._s(e.$t("RuleEngine.delete"))+"\n ")])]}}])})],1)],1)],1),n("resource-dialog",{attrs:{editItem:e.resourceToEdit,oper:e.oper,visible:e.dialogVisible},on:{"update:visible":function(t){e.dialogVisible=t},created:e.loadData}})],1)},s=[],i=n("cebc"),r=(n("7f7f"),n("96cf"),n("3b8d")),o=n("bd43"),c=n("d7a3"),u=n("7d5c"),l={name:"Resources",components:{ResourceNode:c["a"],ResourceDialog:u["a"]},props:{},data:function(){return{listLoading:!1,dialogVisible:!1,tableData:[],filterOptions:{resourceTypes:[]},oper:"add",resourceToEdit:{}}},created:function(){this.listLoading=!0,this.initData(),this.loadData()},methods:{toggleShowConfig:function(e){var t=!e.showConfig;this.$set(e,"showConfig",t)},viewResourcesStatus:function(e,t){var n=document.querySelectorAll(".el-table__expand-icon")[t];n&&n.click()},handleExpandChange:function(){var e=Object(r["a"])(regeneratorRuntime.mark(function e(t){var n,a,s=arguments;return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:if(n=s.length>1&&void 0!==s[1]&&s[1],n||!(t.status.length>0)){e.next=3;break}return e.abrupt("return");case 3:return e.next=5,Object(o["j"])(t.id);case 5:a=e.sent,a&&(this.$set(t,"status",a.status),this.$set(t,"typeInfo",a.typeInfo),this.$set(t,"_config",a._config));case 7:case"end":return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}(),deleteResource:function(e){var t=this;this.$msgbox.confirm(this.$t("RuleEngine.deleteResource"),{confirmButtonText:this.$t("Base.confirm"),cancelButtonText:this.$t("Base.cancel"),type:"warning"}).then(Object(r["a"])(regeneratorRuntime.mark(function n(){return regeneratorRuntime.wrap(function(n){while(1)switch(n.prev=n.next){case 0:return n.next=2,Object(o["d"])(e.id);case 2:t.loadData(),t.$message.success(t.$t("RuleEngine.successfulDeletion"));case 4:case"end":return n.stop()}},n)}))).catch(function(){})},initData:function(){var e=Object(r["a"])(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Object(o["k"])();case 2:t=e.sent,this.filterOptions.resourceTypes=t.map(function(e){return{text:e.title,value:e.name}});case 4:case"end":return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}(),loadData:function(){var e=Object(r["a"])(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:return e.prev=0,this.listLoading=!0,e.next=4,Object(o["i"])();case 4:t=e.sent,this.tableData=t.map(function(e){return e.isAvailable=e.status,delete e.status,e._config=[],e.typeInfo={},e.status=[],e}),e.next=11;break;case 8:e.prev=8,e.t0=e["catch"](0),console.log(e.t0);case 11:return e.prev=11,this.listLoading=!1,e.finish(11);case 14:case"end":return e.stop()}},e,this,[[0,8,11,14]])}));function t(){return e.apply(this,arguments)}return t}(),handleDialogVisible:function(e,t){this.dialogVisible=!0,this.oper=e,"edit"===e&&(this.resourceToEdit=Object(i["a"])({},t))},showResource:function(e){this.$router.push({path:"/resources/".concat(e.id),query:{oper:"view"}})},resourceTypesColumnFilter:function(e,t){return t.config.name===e}}},d=l,p=(n("8602"),n("2877")),f=Object(p["a"])(d,a,s,!1,null,null,null);t["default"]=f.exports}}]);