emqx/apps/emqx_enterprise_dashboard/priv/www/static/js/chunk-18aaaf52.04b806a1.js

1 line
36 KiB
JavaScript

(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-18aaaf52"],{"01c8":function(e,t,n){"use strict";n.d(t,"a",function(){return o});var i=n("178b"),r=n("3953"),s=n("1df6");function o(e){return Object(i["a"])(e)||Object(r["a"])(e)||Object(s["a"])()}},"0870":function(e,t,n){"use strict";var i=n("d283"),r=n.n(i);r.a},"0ea0":function(e,t,n){"use strict";var i=n("777d"),r=n.n(i);r.a},"205f":function(e,t,n){},"2c0e":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:"module-detail"},[n("page-header",[n("div",{staticClass:"page-header-title-view"},[n("div",{staticClass:"title"},[e._v("\n "+e._s(e.moduleData.title[e.lang])+"\n ")])]),n("div",{staticClass:"page-header-content-view"},[n("div",{staticClass:"content"},[n("p",{staticClass:"description"},[e._v("\n "+e._s(e.moduleData.description[e.lang])+"\n ")])])]),"edit"===e.oper?n("div",{staticClass:"page-header-top-start delete-btn",on:{click:e.deleteModule}},[n("el-button",{attrs:{type:"danger",size:"small"}},[e._v("\n "+e._s(e.$t("RuleEngine.delete"))+"\n ")])],1):e._e()]),n("div",{staticClass:"app-wrapper"},[n("el-card",[n("div",{staticClass:"emq-title module-title"},[e._v("\n "+e._s(e.$t("Modules.configuration"))+"\n ")]),n("el-form",{ref:"record",attrs:{model:e.record,rules:e.rules,"label-position":"top",size:"small"}},[n("el-row",{staticClass:"config-item-wrapper",attrs:{gutter:30}},[e.configList.length>0?[n("el-col",{attrs:{span:16}},e._l(e.configList,function(t,i){return n("div",{key:i},["listener"!==t.key?[n("el-col",{attrs:{span:"textarea"===t.type||"object"===t.type||"array"===t.type?24:12}},["file"===t.elType||["verify","tls_version"].includes(t.key)?[["true",!0].includes(e.record.config["https_enabled"])||["true",!0].includes(e.record.config["ssl"])||void 0===e.record.config["ssl"]&&void 0===e.record.config["https_enabled"]?n("el-form-item",e._b({},"el-form-item",t.formItemAttributes,!1),["file"===t.elType?n("file-editor",{model:{value:e.record.config[t.key],callback:function(n){e.$set(e.record.config,t.key,n)},expression:"record.config[item.key]"}}):n("emq-select",e._b({staticClass:"reset-width",model:{value:e.record.config[t.key],callback:function(n){e.$set(e.record.config,t.key,n)},expression:"record.config[item.key]"}},"emq-select",t.bindAttributes,!1))],1):e._e()]:n("el-form-item",e._b({},"el-form-item",t.formItemAttributes,!1),[t.formItemAttributes.description?n("template",{slot:"label"},[e._v("\n "+e._s(t.formItemAttributes.label)+"\n "),n("el-popover",{attrs:{width:"220",trigger:"hover",placement:"top"}},[n("div",{staticClass:"emq-popover-content",domProps:{innerHTML:e._s(t.formItemAttributes.description)}}),n("i",{staticClass:"el-icon-question",attrs:{slot:"reference"},slot:"reference"})])],1):e._e(),"object"===t.elType?[n("key-and-value-editor",{model:{value:e.record.config[t.key],callback:function(n){e.$set(e.record.config,t.key,n)},expression:"record.config[item.key]"}})]:"array"===t.elType?[n("array-editor",{ref:"arrayEditor",refInFor:!0,attrs:{data:t.oneObjOfArray,isDadRequired:e.rules.config[t.key].length>0},on:{updateValidate:e.updateValidate},model:{value:e.record.config[t.key],callback:function(n){e.$set(e.record.config,t.key,n)},expression:"record.config[item.key]"}})]:"cfgselect"===t.elType?[n("config-select",e._b({staticClass:"reset-width",attrs:{extraConfigs:t.extraConfigs},on:{updateConfig:e.addConfigAccordingType},model:{value:e.record.config[t.key],callback:function(n){e.$set(e.record.config,t.key,n)},expression:"record.config[item.key]"}},"config-select",t.bindAttributes,!1))]:"select"!==t.elType?["number"===t.type?n("el-input",e._b({model:{value:e.record.config[t.key],callback:function(n){e.$set(e.record.config,t.key,e._n(n))},expression:"record.config[item.key]"}},"el-input",t.bindAttributes,!1)):"password"===t.type?n("el-input",e._b({attrs:{"show-password":""},model:{value:e.record.config[t.key],callback:function(n){e.$set(e.record.config,t.key,n)},expression:"record.config[item.key]"}},"el-input",t.bindAttributes,!1)):n("el-input",e._b({model:{value:e.record.config[t.key],callback:function(n){e.$set(e.record.config,t.key,n)},expression:"record.config[item.key]"}},"el-input",t.bindAttributes,!1))]:["number"===t.type?n("emq-select",e._b({staticClass:"reset-width",model:{value:e.record.config[t.key],callback:function(n){e.$set(e.record.config,t.key,e._n(n))},expression:"record.config[item.key]"}},"emq-select",t.bindAttributes,!1)):n("emq-select",e._b({staticClass:"reset-width",model:{value:e.record.config[t.key],callback:function(n){e.$set(e.record.config,t.key,n)},expression:"record.config[item.key]"}},"emq-select",t.bindAttributes,!1))]],2)],2)]:e._e()],2)}),0)]:n("div",{staticClass:"params-loading-wrapper"},[n("a-skeleton",{attrs:{active:""}})],1)],2)],1)],1),Object.keys(e.listener).length?n("el-card",{staticClass:"listener-wrapper"},[n("div",{staticClass:"emq-title listener-title"},[e._v("\n "+e._s(e.$t("Modules.listener"))+"\n ")]),n("Listeners",{attrs:{listenerData:e.listener},model:{value:e.record.config["listeners"],callback:function(t){e.$set(e.record.config,"listeners",t)},expression:"record.config['listeners']"}})],1):e._e()],1),n("el-col",{attrs:{span:1===e.configList.length&&-1===e.fullSpanType.indexOf(e.configList[0].type)?9:16}},[n("div",{staticClass:"button-group__center"},[n("el-button",{attrs:{size:"small"},on:{click:function(t){return e.exitDetail(!0)}}},[e._v(e._s(e.$t("Base.cancel")))]),n("el-button",{staticClass:"dialog-primary-btn",attrs:{loading:e.buttonLoading,type:"primary",size:"small"},on:{click:function(t){return e.handleCreate()}}},["add"===e.oper?n("span",[e._v(e._s(e.$t("Base.add")))]):n("span",[e._v(e._s(e.$t("Base.confirm")))])])],1)])],1)},r=[],s=n("01c8"),o=(n("7f7f"),n("7514"),n("8615"),n("96cf"),n("3b8d")),a=(n("2fdb"),n("7618")),c=(n("456d"),n("6762"),n("ac6a"),n("a8db")),l=n("943d"),u=n("90b9"),d=n("caba"),f=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"array-editor"},[n("el-form",{ref:"form",attrs:{rules:e.form.rules,model:e.form}},[n("el-table",{staticClass:"array-editor",attrs:{data:e.form.tableData,size:"mini","header-cell-class-name":e.addHeaderCellClassName}},[e._l(e.headers,function(t,i){return n("el-table-column",{key:i,attrs:{label:t},scopedSlots:e._u([{key:"default",fn:function(i){var r=i.row,s=i.$index;return[n("el-form-item",{attrs:{prop:"tableData."+s+"."+r[t].formItemAttributes.prop,rules:e.form.rules[r[t].formItemAttributes.prop]}},["select"!==r[t].elType?["number"===r[t].type?n("el-input",e._b({attrs:{size:"small"},on:{input:e.atInputChange},model:{value:r[r[t].key],callback:function(n){e.$set(r,r[t].key,e._n(n))},expression:"row[row[item].key]"}},"el-input",r[t].bindAttributes,!1)):n("el-input",e._b({attrs:{size:"small"},on:{input:e.atInputChange},model:{value:r[r[t].key],callback:function(n){e.$set(r,r[t].key,n)},expression:"row[row[item].key]"}},"el-input",r[t].bindAttributes,!1))]:["number"===r[t].type?n("emq-select",e._b({staticClass:"reset-width",attrs:{size:"small"},on:{change:e.atInputChange},model:{value:r[r[t].key],callback:function(n){e.$set(r,r[t].key,e._n(n))},expression:"row[row[item].key]"}},"emq-select",r[t].bindAttributes,!1)):n("emq-select",e._b({staticClass:"reset-width",attrs:{size:"small"},on:{change:e.atInputChange},model:{value:r[r[t].key],callback:function(n){e.$set(r,r[t].key,n)},expression:"row[row[item].key]"}},"emq-select",r[t].bindAttributes,!1))]],2)]}}],null,!0)},[n("template",{slot:"header"},[n("span",{staticClass:"my-header"},[e._v("\n "+e._s(t)+"\n "),e.descriptionDic[t]?n("el-popover",{attrs:{width:"220",trigger:"hover",placement:"top"}},[n("div",{staticClass:"emq-popover-content",domProps:{innerHTML:e._s(e.descriptionDic[t])}}),n("i",{staticClass:"el-icon-question",attrs:{slot:"reference"},slot:"reference"})]):e._e()],1)])],2)}),n("el-table-column",{attrs:{width:"60px"},scopedSlots:e._u([{key:"default",fn:function(t){var i=t.row;return[n("span",{staticClass:"btn",on:{click:function(t){return e.deleteItem(i)}}},[e._v("\n "+e._s(e.$t("components.delete"))+"\n ")])]}}])},[n("span",{staticClass:"btn",attrs:{slot:"header"},on:{click:e.addColumn},slot:"header"},[e._v("\n "+e._s(e.$t("components.add"))+"\n ")])])],2)],1)],1)},p=[],m=(n("6b54"),n("cebc")),h=n("768b"),g=(n("ffc1"),{name:"MulObjectEditor",components:{},model:{prop:"value",event:"update"},props:{value:{type:Array,required:!0},notNull:{type:Boolean,default:!1},data:{type:Object,required:!0},isDadRequired:{type:Boolean,default:!1}},data:function(){return{headers:[],oneRow:{},defaultConfig:{},allColumnRule:{},form:{tableData:[],rules:{}},innerValid:!0,descriptionDic:{}}},computed:{},created:function(){this.initData()},methods:{assignValue:function(){var e=this;if(this.value.length){for(var t=0;t<this.value.length;t+=1)this.addColumn();this.value.forEach(function(t){var n=e.value.indexOf(t);Object.assign(e.form.tableData[n],t)})}},initData:function(){var e=this,t=this.data,n=t.form,i=t.rules;Object.entries(n).forEach(function(t){var n=Object(h["a"])(t,2),r=(n[0],n[1]),s=r.formItemAttributes.label;e.headers.push(s),e.descriptionDic[s]=r.formItemAttributes.description,e.oneRow[s]=r;var o=r.key,a=r.value;e.oneRow[o]=a,e.defaultConfig[o]=a,e.allColumnRule[s]=i[o]}),Object.assign(this.form.rules,i),this.assignValue()},atInputChange:function(){var e=this;this.validateForm();var t=[];this.form.tableData.forEach(function(n){var i={};Object.keys(e.defaultConfig).forEach(function(e){i[e]=n[e]}),t.push(i)}),this.$emit("update",t),this.isDadRequired&&this.$emit("updateValidate")},deleteItem:function(e){var t=this;this.form.tableData=this.form.tableData.filter(function(t){return t.key!==e.key}),setTimeout(function(){t.atInputChange()},50)},addColumn:function(){var e=this,t=Object(m["a"])({},this.oneRow);t.key=Math.random().toString(16).slice(3),this.form.tableData.push(t),setTimeout(function(){e.atInputChange()},50)},addHeaderCellClassName:function(e){e.row;var t=e.column,n=(e.rowIndex,e.columnIndex,this.allColumnRule[t.label]);if(n){var i=n.find(function(e){return!0===e.required});return i?"requiredclass":""}return!0},validateForm:function(){var e=this;this.$refs.form.validate(function(t){e.innerValid=t})}}}),b=g,v=(n("0ea0"),n("2877")),y=Object(v["a"])(b,f,p,!1,null,null,null),k=y.exports,_=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"listeners"},[e._l(e.showItemList,function(t,i){return n("div",{key:i,staticClass:"listener-item"},[n("div",{staticClass:"listener-item-head"},[e._l(Object.keys(t),function(i,r){return n("div",{key:r,staticClass:"listener-item-type"},[n("div",{staticClass:"title"},[e._v(e._s(e.$t("Modules."+i)))]),n("div",{staticClass:"desc"},[e._v(e._s(t[i]))])])}),n("div",{staticClass:"listener-item-btn"},[n("span",{staticClass:"btn",on:{click:function(t){return e.editListener(i)}}},[e._v("\n "+e._s(e.$t("Modules.edit"))+"\n ")]),n("span",{staticClass:"btn",on:{click:function(t){return e.removeListener(i)}}},[e._v("\n "+e._s(e.$t("Modules.remove"))+"\n ")])])],2)])}),n("el-button",{attrs:{size:"small",icon:"el-icon-plus"},on:{click:e.addListener}},[e._v("\n "+e._s(e.$t("Modules.addListener"))+"\n ")]),n("el-dialog",{attrs:{visible:e.listenerDialogVisible,title:e.listenerDialogTitle,width:"520px"},on:{open:e.loadConfigList,"update:visible":function(t){e.listenerDialogVisible=t}}},[n("el-form",{ref:"record",attrs:{model:e.record,rules:e.rules,size:"small","label-position":"top"}},[n("el-row",{staticClass:"config-item-wrapper",attrs:{gutter:20}},[e.configLoading?n("div",{staticClass:"params-loading-wrapper"},[n("a-skeleton",{attrs:{active:""}})],1):e.showConfigList.length>0?e._l(e.showConfigList,function(t,i){return n("div",{key:i},[n("el-col",{attrs:{span:"textarea"===t.type||"object"===t.type?24:12}},[n("el-form-item",e._b({},"el-form-item",t.formItemAttributes,!1),[t.formItemAttributes.description?n("template",{slot:"label"},[e._v("\n "+e._s(t.formItemAttributes.label)+"\n "),n("el-popover",{attrs:{width:"220",trigger:"hover",placement:"top"}},[n("div",{staticClass:"emq-popover-content",domProps:{innerHTML:e._s(t.formItemAttributes.description)}}),n("i",{staticClass:"el-icon-question",attrs:{slot:"reference"},slot:"reference"})])],1):e._e(),"object"===t.elType?[n("key-and-value-editor",{model:{value:e.record.config[t.key],callback:function(n){e.$set(e.record.config,t.key,n)},expression:"record.config[item.key]"}})]:"file"===t.elType?[n("file-editor",{model:{value:e.record.config[t.key],callback:function(n){e.$set(e.record.config,t.key,n)},expression:"record.config[item.key]"}})]:"select"!==t.elType?["number"===t.type?n("el-input",e._b({model:{value:e.record.config[t.key],callback:function(n){e.$set(e.record.config,t.key,e._n(n))},expression:"record.config[item.key]"}},"el-input",t.bindAttributes,!1)):"password"===t.type?n("el-input",e._b({attrs:{"show-password":""},model:{value:e.record.config[t.key],callback:function(n){e.$set(e.record.config,t.key,n)},expression:"record.config[item.key]"}},"el-input",t.bindAttributes,!1)):n("el-input",e._b({model:{value:e.record.config[t.key],callback:function(n){e.$set(e.record.config,t.key,n)},expression:"record.config[item.key]"}},"el-input",t.bindAttributes,!1))]:["number"===t.type?n("emq-select",e._b({staticClass:"reset-width",model:{value:e.record.config[t.key],callback:function(n){e.$set(e.record.config,t.key,e._n(n))},expression:"record.config[item.key]"}},"emq-select",t.bindAttributes,!1)):n("emq-select",e._b({staticClass:"reset-width",model:{value:e.record.config[t.key],callback:function(n){e.$set(e.record.config,t.key,n)},expression:"record.config[item.key]"}},"emq-select",t.bindAttributes,!1))]],2)],1)],1)}):e._e()],2)],1),n("div",{staticClass:"dialog-align-footer",attrs:{slot:"footer"},slot:"footer"},[n("el-button",{attrs:{size:"small"},on:{click:e.handleCancel}},[e._v("\n "+e._s(e.$t("Base.cancel"))+"\n ")]),n("el-button",{staticClass:"dialog-primary-btn",attrs:{type:"primary",size:"small"},on:{click:e.handleCreate}},[e._v("\n "+e._s(e.$t("Base.confirm"))+"\n ")])],1)],1)],2)},C=[],$=n("faa11"),w={name:"Listeners",components:{KeyAndValueEditor:d["a"],FileEditor:$["a"]},model:{prop:"value",event:"update"},props:{value:{type:Array,required:!0},listenerData:{type:Object,required:!0}},data:function(){return{listenerDialogTitle:this.$t("Modules.addListener"),listenerDialogVisible:!1,record:{config:{}},rules:{config:{}},showConfigList:[],commonConfigs:[],commonRules:{config:{}},commonRecord:{config:{}},optionConfig:{},configLoading:!1,showItemList:[],listenerList:[],currentOper:"",selectedListener:{},currentEditIndex:0}},computed:{listener_type:function(){return this.record.config.listener_type}},watch:{listener_type:function(e){this.addDataAccordingListenerType(e)}},created:function(){var e=this;this.value.length&&(this.listenerList=this.value,this.value.forEach(function(t){var n=t.listen_on,i=t.listener_type,r=t.acceptors,s=t.active_n,o=t.max_conn_rate,a=t.max_connections;e.showItemList.push({listen_on:n,listener_type:i,acceptors:r,active_n:s,max_conn_rate:o,max_connections:a})}))},methods:{addDataAccordingListenerType:function(e){var t=this,n="".concat(e,"_options"),i=this.optionConfig[n],r=i.form,o=i.rules,a=Object(s["a"])(this.commonConfigs),c=a.slice(0),l=Object.assign({},this.commonRules.config),d=Object.assign({},this.commonRecord.config);this.showConfigList=c.concat(r);var f={};r.forEach(function(e){var n=e.key,i=e.value;t.$set(f,n,i)}),this.record.config=Object.assign(d,f),this.rules.config=Object.assign(l,o);var p=[{required:!0,validator:u["r"]}];this.rules.config.listen_on=p,"edit"===this.currentOper&&Object.assign(this.record.config,this.selectedListener),this.record.config.listener_type=e,this.$refs.record&&setTimeout(this.$refs.record.clearValidate,10)},cleanOldData:function(){this.commonConfigs=[],this.commonRules.config={},this.rules.config={},this.optionConfig={},this.record.config={},this.showConfigList=[]},loadConfigList:function(){var e=this;this.cleanOldData(),this.configLoading=!0;var t=Object.assign({},this.listenerData);Object.keys(t).forEach(function(n){if(t[n]=Object(u["l"])(t[n],"config"),n.includes("options"))e.optionConfig[n]=t[n];else{var i=t[n],r=i.form,s=i.rules;e.commonConfigs=e.commonConfigs.concat(r),e.commonRules.config=Object.assign(e.commonRules.config,s)}}),this.commonRecord.config={},this.commonConfigs.forEach(function(t){var n=t.key,i=t.value;e.$set(e.commonRecord.config,n,i)}),this.showConfigList=this.commonConfigs,this.record=Object(m["a"])({},this.commonRecord),"add"===this.currentOper?this.addDataAccordingListenerType(this.commonRecord.config.listener_type):this.addDataAccordingListenerType(this.selectedListener.listener_type),this.configLoading=!1,this.$refs.record&&setTimeout(this.$refs.record.clearValidate,10)},atDialogClose:function(){var e=this;setTimeout(function(){e.$refs.record.clearValidate(),e.listenerDialogVisible=!1},10)},handleCreate:function(){var e=Object(o["a"])(regeneratorRuntime.mark(function e(){var t,n,i,r,s,o,a,c,l,u=this;return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,this.$refs.record.validate();case 2:if(t=e.sent,t){e.next=5;break}return e.abrupt("return");case 5:n=this.record.config,Object.keys(n).forEach(function(e){var t=n[e];"true"===t&&(u.record.config[e]=!0),"false"===t&&(u.record.config[e]=!1)}),i=n.listen_on,r=n.listener_type,s=n.acceptors,o=n.active_n,a=n.max_conn_rate,c=n.max_connections,"add"===this.currentOper?(this.showItemList.push({listen_on:i,listener_type:r,acceptors:s,active_n:o,max_conn_rate:a,max_connections:c}),this.listenerList.push(n)):(l={listen_on:i,listener_type:r,acceptors:s,active_n:o,max_conn_rate:a,max_connections:c},this.listenerList.splice(this.currentEditIndex,1,n),this.showItemList.splice(this.currentEditIndex,1,l)),this.$emit("update",this.listenerList),this.atDialogClose();case 11:case"end":return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}(),handleCancel:function(){this.atDialogClose()},addListener:function(){this.currentOper="add",this.listenerDialogTitle=this.$t("Modules.addListener"),this.listenerDialogVisible=!0},editListener:function(e){this.currentOper="edit",this.currentEditIndex=e,this.listenerDialogTitle=this.$t("Modules.editListener"),this.selectedListener=Object(m["a"])({},this.listenerList[e]),this.listenerDialogVisible=!0},removeListener:function(e){this.showItemList.splice(e,1),this.listenerList.splice(e,1),this.$emit("update",this.listenerList)}}},x=w,O=(n("5555"),Object(v["a"])(x,_,C,!1,null,null,null)),j=O.exports,L=n("6985"),D=n("2ef0"),R=n.n(D),I={name:"ModuleDetail",components:{KeyAndValueEditor:d["a"],ArrayEditor:k,Listeners:j,FileEditor:$["a"],ConfigSelect:L["a"]},inheritAttrs:!1,data:function(){return{configLoading:!1,configList:[],record:{config:{}},rules:{config:{}},allModuleList:[],listener:{},fullSpanType:["array","object","textarea"],originConfigList:[],originRules:{config:{}},originRecord:{config:{}},buttonLoading:!1}},computed:{oper:function(){return this.$store.state.selectedModule.oper},moduleData:function(){return this.$store.state.selectedModule},from:function(){return this.$store.state.selectedModule.from},lang:function(){return this.$store.state.lang},recordConfig:function(){return this.record.config},listeners:function(){return this.record.config.listeners}},watch:{listeners:{deep:!0,immediate:!0,handler:"handlelistenersChange"}},created:function(){this.loadData(),this.initListeners(),document.documentElement.scrollTop=0,document.body.scrollTop=0},methods:{handlelistenersChange:function(e){this.originRecord.config.listeners=R.a.cloneDeep(e)},updateValidate:function(){this.$refs.record.validate()},loadData:function(){var e=this;"add"===this.oper?this.loadConfigList(this.moduleData.paramsData):this.loadParams().then(function(t){e.loadConfigList(t)}).catch()},cleanForm:function(){var e=this;this.$refs.record&&setTimeout(function(){e.$refs.record.resetFields(),e.configList=[]},10)},loadConfigList:function(e){var t=this,n=e.listener,i=Object(c["a"])(e,["listener"]);n&&(this.listener=n),this.configLoading=!0;var r=Object(u["l"])(i,"config"),s=r.form,o=r.rules;this.configList=s,this.rules.config=o,this.record.config={},s.forEach(function(e){var n=e.key,i=e.value;t.$set(t.record.config,n,i)}),this.initListeners(),this.storeOriginData(r),this.configLoading=!1,this.$refs.record&&setTimeout(this.$refs.record.clearValidate,10)},cleanFileContent:function(e){var t=[!1,"false"];(t.includes(e.ssl)||t.includes(e.https_enabled))&&(e.verify=!1,Object.keys(e).forEach(function(t){var n=e[t];"object"===Object(a["a"])(n)&&Object.keys(n).includes("file")&&(e[t]={file:"",filename:""})}))},handleCreate:function(){var e=Object(o["a"])(regeneratorRuntime.mark(function e(){var t,n,i,r,s,o,a=this;return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:if(t=this.$refs.arrayEditor,!t||!1!==t[0]._data.innerValid){e.next=3;break}return e.abrupt("return");case 3:return e.next=5,this.$refs.record.validate();case 5:if(n=e.sent,n){e.next=8;break}return e.abrupt("return");case 8:if(!Object.keys(this.listener).length||this.record.config.listeners.length){e.next=11;break}return this.$message.error(this.$t("Modules.emptyListenerTip")),e.abrupt("return");case 11:if(i=this.record.config,Object.keys(i).forEach(function(e){var t=i[e];"true"===t&&(a.record.config[e]=!0),"false"===t&&(a.record.config[e]=!1)}),this.cleanFileContent(i),"add"!==this.oper){e.next=28;break}return this.buttonLoading=!0,this.record.type=this.moduleData.type,e.next=19,Object(l["d"])(this.record);case 19:r=e.sent,s=JSON.parse(localStorage.getItem("addedModules"))||{},s[r.type]=r.id,localStorage.setItem("addedModules",JSON.stringify(s)),this.$message.success(this.$t("Modules.moduleAddSuccess")),this.exitDetail(),this.buttonLoading=!1,e.next=30;break;case 28:o=!R.a.isEqual(this.record.config,this.originRecord.config),o?this.$confirm(this.$t("Modules.editTip"),this.$t("Base.warning"),{type:"warning",cancelButtonText:this.$t("Base.cancel"),confirmButtonText:this.$t("Modules.continueCommit")}).then(function(){a.confirmEditModule()}).catch(function(){}):this.exitDetail();case 30:case"end":return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}(),confirmEditModule:function(){var e=Object(o["a"])(regeneratorRuntime.mark(function e(){var t,n,i,r,s,o;return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:return t=this.moduleData,n=t.type,i=t.id,r=t.enabled,s=t.description,o={type:n,id:i,enabled:r,description:s,config:this.record.config},e.next=4,Object(l["v"])(i,o);case 4:this.$message.success(this.$t("Modules.moduleEditSuccess")),this.exitDetail();case 6:case"end":return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}(),parseI18n:function(e){var t=Object(u["c"])(e,["title","description"]).map(function(e){return e.params=Object(u["c"])(e.params,!0),e});return t},loadParams:function(){var e=Object(o["a"])(regeneratorRuntime.mark(function e(){var t,n,i,r=this;return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Object(l["o"])();case 2:return t=e.sent,Object.values(t).forEach(function(e){r.allModuleList=r.allModuleList.concat(e)}),n=this.allModuleList.find(function(e){return e.name===r.moduleData.type}),this.parseI18n([n]),i=n.params,Object.keys(i).forEach(function(e){void 0!==r.moduleData.config[e]&&(i[e].default=r.moduleData.config[e])}),e.abrupt("return",i);case 9:case"end":return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}(),deleteModule:function(){var e=this;this.$msgbox.confirm(this.$t("Modules.thisActionWillDeleteTheModule"),{confirmButtonText:this.$t("Base.confirm"),cancelButtonText:this.$t("Base.cancel"),type:"warning"}).then(Object(o["a"])(regeneratorRuntime.mark(function t(){var n;return regeneratorRuntime.wrap(function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,Object(l["i"])(e.moduleData.id);case 2:e.$message.success(e.$t("Base.deleteSuccess")),n=JSON.parse(localStorage.getItem("addedModules"))||{},delete n[e.moduleData.type],localStorage.setItem("addedModules",JSON.stringify(n)),e.exitDetail();case 7:case"end":return t.stop()}},t)}))).catch(function(){})},exitDetail:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.cleanForm(),setTimeout(function(){"modules"!==e.from&&t?e.$router.push("/modules/select?id=".concat(e.$route.query.id,"&top=").concat(e.$route.query.top)):e.$router.push("/modules")},10)},initListeners:function(){if(Object.keys(this.listener).length)if("add"===this.oper)this.record.config.listeners=[];else{var e=this.moduleData.config.listeners;this.record.config.listeners=e||[]}this.originRecord.config.listeners=R.a.cloneDeep(this.record.config.listeners)},storeOriginData:function(e){var t=this,n=e.form,i=e.rules;this.originConfigList=n,this.originRules.config=i,this.originRecord.config={},n.forEach(function(e){var n=e.key,i=e.value;t.$set(t.originRecord.config,n,i)})},addConfigAccordingType:function(e,t){var n=this,i=Object(s["a"])(this.originConfigList),r=i.slice(0),o=Object.assign({},this.originRules.config),a=Object.assign({},this.originRecord.config);if(Object.keys(e).length){var c=Object(u["l"])(e,"config"),l=c.form,d=c.rules,f={};l.forEach(function(e){var t=e.key,i=e.value;n.$set(f,t,i)}),this.configList=r.concat(l),this.rules.config=Object.assign(o,d),this.record.config=Object.assign(a,f)}else this.configList=r,this.rules.config=o,this.record.config=a;this.record.config.type=t,this.$refs.record&&setTimeout(this.$refs.record.clearValidate,10)}}},E=I,A=(n("b4ec"),Object(v["a"])(E,i,r,!1,null,null,null));t["default"]=A.exports},4964:function(e,t,n){"use strict";var i=n("61e3"),r=n.n(i);r.a},5555:function(e,t,n){"use strict";var i=n("c776"),r=n.n(i);r.a},"61e3":function(e,t,n){},6985:function(e,t,n){"use strict";var i=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("el-select",e._g(e._b({staticClass:"emq-select",attrs:{value:e.rawValue},on:{change:e.valueChange}},"el-select",e.$attrs,!1),e.$listeners),[e._t("default",e._l(e.options,function(t,i){return n("el-option",{key:i,attrs:{value:t[e.fieldName.value],label:t[e.fieldName.label],disabled:e.isDisabled(t)}},[e._t("option",null,{item:t})],2)}))],2)},r=[],s=(n("6762"),n("2fdb"),n("96cf"),n("3b8d")),o=(n("7514"),n("6b54"),n("1f75")),a={name:"ConfigSelect",components:{},props:{value:{required:!0},field:{type:Object,required:!0},fieldName:{type:Object,default:function(){return{label:"label",value:"value"}}},disabledItem:{type:Array,default:function(){return[]}},refresh:{type:Boolean},extraConfigs:{type:Object,defaule:function(){}}},data:function(){return{options:[],parserField:{}}},computed:{rawValue:{get:function(){return"boolean"===typeof this.value?this.value.toString():this.value},set:function(e){var t=null,n=this.fieldName.value,i=this.options.find(function(t){return t[n]===e});i&&this.parserField[n]&&(t="true"===e),this.$emit("update:value",t)}}},watch:{refresh:function(e){e&&this.loadData()},field:{handler:function(){this.loadData()},deep:!0}},created:function(){this.loadData(),this.$emit("updateConfig",this.extraConfigs[this.rawValue],this.rawValue,this.extraConfigs)},methods:{valueChange:function(e){e&&this.$emit("updateConfig",this.extraConfigs[e],e,this.extraConfigs)},loadData:function(){var e=Object(s["a"])(regeneratorRuntime.mark(function e(){var t,n,i,r=this;return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,this.getOptions();case 2:t=e.sent,this.parserField={},n=this.fieldName.value,i=this.fieldName.label,this.options=t.map(function(e){var t=e[n],s=e[i];return"boolean"===typeof t&&(r.parserField[n]="boolean",e[n]=t.toString(),"boolean"===typeof s&&(e[i]=s.toString())),e}),this.$emit("update:refresh",!1);case 8:case"end":return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}(),isDisabled:function(e){return this.disabledItem.includes(e[this.fieldName.value])},getOptions:function(){var e=Object(s["a"])(regeneratorRuntime.mark(function e(){var t,n,i,r,s,a;return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:if(t=this.field,n=t.api,i=t.url,r=t.options,s=t.list,a=[],!r){e.next=6;break}a=r,e.next=20;break;case 6:if(!s){e.next=10;break}a=s.map(function(e){return{label:e,value:e}}),e.next=20;break;case 10:if(!n){e.next=16;break}return e.next=13,n();case 13:a=e.sent,e.next=20;break;case 16:if(!i){e.next=20;break}return e.next=19,o["a"].get(i);case 19:a=e.sent;case 20:return e.abrupt("return",a);case 21:case"end":return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()}},c=a,l=(n("4964"),n("2877")),u=Object(l["a"])(c,i,r,!1,null,null,null);t["a"]=u.exports},"6fc1":function(e,t,n){},"777d":function(e,t,n){},"943d":function(e,t,n){"use strict";n.d(t,"o",function(){return s}),n.d(t,"d",function(){return o}),n.d(t,"q",function(){return a}),n.d(t,"s",function(){return c}),n.d(t,"i",function(){return l}),n.d(t,"v",function(){return u}),n.d(t,"b",function(){return d}),n.d(t,"p",function(){return f}),n.d(t,"u",function(){return p}),n.d(t,"g",function(){return m}),n.d(t,"n",function(){return h}),n.d(t,"a",function(){return g}),n.d(t,"f",function(){return b}),n.d(t,"e",function(){return v}),n.d(t,"m",function(){return y}),n.d(t,"c",function(){return _}),n.d(t,"j",function(){return C}),n.d(t,"h",function(){return $}),n.d(t,"t",function(){return w}),n.d(t,"k",function(){return x}),n.d(t,"l",function(){return O}),n.d(t,"r",function(){return j});n("ac6a"),n("456d"),n("96cf");var i=n("3b8d"),r=n("1f75");function s(){return r["a"].get("/module_types")}function o(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return r["a"].post("/modules",e)}function a(){return r["a"].get("/modules")}function c(e){return r["a"].get("/modules/".concat(e))}function l(e){return r["a"].delete("/modules/".concat(e))}function u(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return r["a"].put("/modules/".concat(e),t)}function d(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return r["a"].post("/auth_".concat(e),t)}function f(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return r["a"].get("/auth_".concat(e),{params:t})}function p(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r["a"].put("/auth_".concat(e,"/").concat(encodeURIComponent(t)),n)}function m(e,t){return r["a"].delete("/auth_".concat(e,"/").concat(encodeURIComponent(t)))}function h(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return r["a"].get("/acl/".concat(e),{params:t})}function g(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return r["a"].post("/acl",e)}function b(e,t,n){return r["a"].delete("/acl/".concat(e,"/").concat(encodeURIComponent(t),"/topic/").concat(encodeURIComponent(n)))}function v(e){return r["a"].delete("/acl/$all/topic/".concat(encodeURIComponent(e)))}function y(e){return k.apply(this,arguments)}function k(){return k=Object(i["a"])(regeneratorRuntime.mark(function e(t){var n,i,s;return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,r["a"].get("/sasl?mechanism=".concat(t));case 2:return n=e.sent,i=Object.keys(n)[0],s=[],n[i].forEach(function(e){var t={username:e};s.push(t)}),e.abrupt("return",s);case 7:case"end":return e.stop()}},e)})),k.apply(this,arguments)}function _(e){return r["a"].post("/sasl",e)}function C(e){return r["a"].put("/sasl",e)}function $(e,t){return r["a"].delete("/sasl?mechanism=".concat(e,"&username=").concat(encodeURIComponent(t)))}function w(e,t){return r["a"].get("/sasl?mechanism=".concat(e,"&username=").concat(encodeURIComponent(t)))}function x(e){return r["a"].get("/nodes/".concat(e,"/lwm2m_channels"))}function O(e,t,n,i){return r["a"].get("/nodes/".concat(e,"/lookup_cmd/").concat(t,"?msgType=").concat(n,"&path=").concat(i))}function j(e){return r["a"].post("/mqtt/publish",e)}},a8db:function(e,t,n){"use strict";var i=n("e265"),r=n.n(i),s=n("a4bb"),o=n.n(s);function a(e,t){if(null==e)return{};var n,i,r={},s=o()(e);for(i=0;i<s.length;i++)n=s[i],t.indexOf(n)>=0||(r[n]=e[n]);return r}function c(e,t){if(null==e)return{};var n,i,s=a(e,t);if(r.a){var o=r()(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}n.d(t,"a",function(){return c})},b4ec:function(e,t,n){"use strict";var i=n("205f"),r=n.n(i);r.a},c776:function(e,t,n){},caba:function(e,t,n){"use strict";var i=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("el-table",{staticClass:"key-and-value-editor",attrs:{data:e.tableData,size:"mini"}},[n("el-table-column",{attrs:{prop:"key",label:e.$t("components.key"),"min-width":"80px"},scopedSlots:e._u([{key:"default",fn:function(t){var i=t.row;return[n("el-input",{staticClass:"key-input",staticStyle:{width:"120px !important"},attrs:{size:"mini",placeholder:e.$t("components.objectKey")},on:{input:e.atInputChange},model:{value:i.key,callback:function(t){e.$set(i,"key",t)},expression:"row.key"}})]}}])}),n("el-table-column",{attrs:{prop:"value",label:e.$t("components.value"),"min-width":"150px"},scopedSlots:e._u([{key:"default",fn:function(t){var i=t.row;return[n("el-input",{attrs:{size:"mini"},on:{input:e.atInputChange},model:{value:i.value,callback:function(t){e.$set(i,"value",t)},expression:"row.value"}})]}}])}),n("el-table-column",{attrs:{width:"60px"},scopedSlots:e._u([{key:"default",fn:function(t){var i=t.row;return[n("span",{staticClass:"btn",on:{click:function(t){return e.deleteItem(i)}}},[e._v("\n "+e._s(e.$t("components.delete"))+"\n ")])]}}])},[n("span",{staticClass:"btn",attrs:{slot:"header"},on:{click:e.addColumn},slot:"header"},[e._v("\n "+e._s(e.$t("components.add"))+"\n ")])])],1)},r=[],s=n("768b"),o=(n("ffc1"),n("ac6a"),{name:"KeyAndValueEditor",components:{},model:{prop:"value",event:"update"},props:{value:{type:Object,required:!0},notNull:{type:Boolean,default:!1}},data:function(){return{row:{key:"",value:"",state:0},tableData:[]}},computed:{},created:function(){var e=[],t=this.value;Object.entries(t).forEach(function(t){var n=Object(s["a"])(t,2),i=n[0],r=n[1];e.push({key:i,value:r,state:0})}),this.tableData=e},methods:{atInputChange:function(){var e={};this.tableData.forEach(function(t){var n=t.key,i=t.value;e[n]=i}),this.$emit("update",e)},deleteItem:function(e){this.tableData=this.tableData.filter(function(t){return t.key!==e.key}),this.atInputChange()},addColumn:function(){this.tableData.push({key:"",value:"",state:0})}}}),a=o,c=(n("db2b"),n("2877")),l=Object(c["a"])(a,i,r,!1,null,null,null);t["a"]=l.exports},d283:function(e,t,n){},db2b:function(e,t,n){"use strict";var i=n("6fc1"),r=n.n(i);r.a},faa11:function(e,t,n){"use strict";var i=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"file-editor"},[n("el-row",[n("el-col",{attrs:{span:22}},[n("el-form-item",{staticStyle:{"margin-bottom":"0px"}},[n("el-input",{attrs:{placeholder:e.$t("Modules.fileTip")},model:{value:e.value.filename,callback:function(t){e.$set(e.value,"filename",t)},expression:"value.filename"}})],1)],1),n("el-col",{attrs:{span:2}},[n("el-upload",{ref:"upload",attrs:{"show-file-list":!1,action:"/api/v4/data/file","auto-upload":!1,"on-change":e.handleChange,"on-error":e.handleError}},[n("i",{staticClass:"el-icon-folder-opened file-icon"})])],1)],1)],1)},r=[],s=(n("6b54"),n("7f7f"),n("96cf"),n("3b8d")),o={name:"FileEditor",model:{prop:"value",event:"update"},props:{value:{type:Object,required:!0}},methods:{handleChange:function(e){var t=this,n=new FileReader;n.readAsText(e.raw),n.onload=function(){var n=Object(s["a"])(regeneratorRuntime.mark(function n(i){var r,s;return regeneratorRuntime.wrap(function(n){while(1)switch(n.prev=n.next){case 0:r=i.currentTarget.result,s={file:r,filename:e.name},t.$emit("update",s);case 3:case"end":return n.stop()}},n)}));return function(e){return n.apply(this,arguments)}}(),n.onerror=function(){t.$message.error(t.$t("Backup.uploadFailed"))}},handleError:function(e){this.$message.error(e.toString())}}},a=o,c=(n("0870"),n("2877")),l=Object(c["a"])(a,i,r,!1,null,null,null);t["a"]=l.exports}}]);